# backtrack5怎么设置静态ip

**URL:** <https://forum.90sec.com/t/topic/3495>\
**Category:** 交流讨论\
**Created:** [2012 年4 月 27 日 10:29 UTC](https://forum.90sec.com/t/topic/3495 "2012-04-27T10:29:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

作者： ![user40](https://forum.90sec.com/user_avatar/forum.90sec.com/user40/32/11393_2.png) [@user40](https://forum.90sec.com/u/user40)\
发布日期： [2012 年4 月 27 日 10:29 UTC](https://forum.90sec.com/t/topic/3495/1 "2012-04-27T10:29:58Z")

</div>

如题，电脑配置太差，设置个静态ip连接ssh方便点，玩msf没那么卡 ！谢谢

---

<div class="post-metadata">

作者： ![user40](https://forum.90sec.com/user_avatar/forum.90sec.com/user40/32/11393_2.png) [@user40](https://forum.90sec.com/u/user40)\
发布日期： [2012 年4 月 27 日 11:23 UTC](https://forum.90sec.com/t/topic/3495/2 "2012-04-27T11:23:39Z")

</div>

还有些疑问：为何我的bt5的ip重启几次后都没变呢？ 然后我每次 开虚拟机需要重启下ssh才能连接是怎么回事？希望解决过这些问题的兄弟把宝贵的经验分享出来 谢谢

---

<div class="post-metadata">

作者： ![wenzicishui](https://forum.90sec.com/letter_avatar_proxy/v4/letter/w/bc8723/32.png) [@wenzicishui](https://forum.90sec.com/u/wenzicishui)\
发布日期： [2012 年4 月 27 日 15:13 UTC](https://forum.90sec.com/t/topic/3495/3 "2012-04-27T15:13:44Z")

</div>

vi /etc/network/interface

---

<div class="post-metadata">

作者： ![Green\_leaves](https://forum.90sec.com/user_avatar/forum.90sec.com/green_leaves/32/11332_2.png) [@Green\_leaves](https://forum.90sec.com/u/Green_leaves)\
发布日期： [2012 年5 月 2 日 12:41 UTC](https://forum.90sec.com/t/topic/3495/4 "2012-05-02T12:41:50Z")

</div>

\*\*回复 [1#](http://www.90sec.org/redirect.php?goto=findpost&pid=24237&ptid=2191) _麦田丶守望者_ \*\*

nano /etc/network/interfaces  
auto lo  
iface lo inet loopback

auto eth0  
iface eth0 inet static  
address 12.34.56.78 设置的IP  
netmask 255.255.255.0 掩码地址  
gateway 12.34.56.0 网关地址

保存，然后/etc/init.d/networking restart，重启网络服务

---

<div class="post-metadata">

作者： ![winy](https://forum.90sec.com/user_avatar/forum.90sec.com/winy/32/11446_2.png) [@winy](https://forum.90sec.com/u/winy)\
发布日期： [2012 年5 月 2 日 17:59 UTC](https://forum.90sec.com/t/topic/3495/5 "2012-05-02T17:59:56Z")

</div>

_本帖最后由 winy 于 2012-5-3 02:00 编辑_

①设置静态ip  
ifconfig eth0 192.168.158.221 netmask 255.255.255.0

②SSH连接  
如果你直接运行 servicessh start 你会发现虽然22端口打开但是还是无法连接ssh。查看启动提示发现按照提示是缺少证书，没有证书我们就来生成。。呵呵

ssh-keygen -t dsa -f/etc/ssh/ssh\_host\_dsa\_key  
ssh-keygen -t rsa -f/etc/ssh/ssh\_host\_rsa\_key  
指向这两行命令然后里面会要求输入证书密码，我们就用空好了，直接回车。

好了现在可以连接ssh了~~
