ubuntu 配置静态ip

1.sudo vi /etc/network/interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 59.151.60.10

格式是:
auto eth1
iface eth1 inet static
address IP地址
netmask 子网掩码
network  
broadcast 广播地址
hwaddress ether XX:XX:XX:XX:XX:XX #MAC地址,冒号分开
gateway 192.168.10.225
nameserver 202.168.134.133
nameserver 192.168.1.1

2.sudo vi /etc/resolv.conf
/etc/resolvconf/resolv.conf.d/
nameserver  192.168.1.253
nameserver  192.168.1.254

3.重启网络配置
sudo /etc/init.d/networking stop
sudo /etc/init.d/networking start
sudo /etc/init.d/networking restart

4.查看路由相关信息
route -n

/etc/resolvconf/resolv.conf.d/

linux 
/etc/sysconfig/network-scripts
resolv.conf
system-config-securltylevel

ubuntu
/etc/network/interfaces
/etc/resolv.conf
/etc/hostname
 
sudo /etc/init.d/networking restart

/etc/services
sudo netstat -ap

你可能感兴趣的:(ubuntu)