|
1
2
3
4
5
6
|
# vim /etc/network/interfacesauto loiface lo inet loopbackauto eth0iface eth0 inet dhcp # 表示默认使用DHCP分配IP |
|
1
2
3
4
5
6
7
8
9
10
|
auto loiface lo inet loopback# The primary network interfaceauto eth0#iface eth0 inet dhcpiface eth0 inet staticaddress 192.168.1.250netmask 255.255.255.0gateway 192.168.1.1 |
|
1
2
3
4
5
|
root@localhost:~# route -nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 |
|
1
2
3
4
5
|
# vim /etc/resolv.conf# 添加如下内容nameserver 192.168.1.1nameserver 223.5.5.5 |
|
1
2
3
|
# vim /etc/resolvconf/resolv.conf.d/basenameserver 192.168.1.1nameserver 223.5.5.5 |
|
1
|
sudo /etc/init.d/networking restart |
本文详细介绍如何在Linux系统中配置静态IP地址及DNS服务器,包括编辑系统文件、配置DNS服务器以及重启网络服务等步骤。
8244

被折叠的 条评论
为什么被折叠?



