|
Ubuntu 设定静态IP:
切换到root用户,然后进入/etc/network目录。备份interfaces文件(备份文件是一个好习惯)
下面编辑interfaces文件,添加如下语句:
?
|
1
2
3
4
5
6
7
8
9
|
1
2 iface eth0 inet static
3 address 192.168.196.135
4 netmask 255.255.255.0
5 gateway 192.168.196.255
6
7
8 dns-nameservers 192.168.196.255
9 auto eth0
|
编辑完成后的interfaces文件内容如下:
?
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
root@ubuntu:/etc/network
auto lo
iface lo inet loopback
iface eth0 inet static
address 192.168.196.135
netmask 255.255.255.0
gateway 192.168.196.255
dns-nameservers 192.168.196.255
auto eth0
|
下一步就是重启网卡:
?
|
1
2
3
4
5
6
7
|
root@ubuntu:/etc/network
重启完成后,测试一下:
root@ubuntu:/etc/network
PING www.a.shifen.com (220.181.112.244) 56(84) bytes of data.
64 bytes from 220.181.112.244: icmp_req=1 ttl=128 time=6.12 ms
64 bytes from 220.181.112.244: icmp_req=2 ttl=128 time=14.7 ms
|
OK。静态IP设置完成。
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
原文链接:http://www.cnblogs.com/vikings-blog/p/3911905.html |