ubuntu 网络设置 from dhcp to static

os:ubuntu 12.04

configuration files:/etc/network/interfaces

content:

# ,,,,,,,,,,,,,,,,,,

#....................

#....................

auto lo

iface lo inet loopback

 

# The primary network interface

auto eth0

iface eth0 inet static

address 192.168.1.18

netmask 255.255.255.0

gateway 192.168.1.1

dns-nameservers 8.8.8.8

# 加载预设的防火墙策略

pre-up iptables-restore < /etc/iptables.up.rules

生效:sudo /etc/init.d/networking restart

猜你喜欢

转载自hellozzy.iteye.com/blog/1982812