Ubuntu server 网络设置

检查网络设置

ifconfig

更改以太网配置

# 更改以太网配置文件
sudo vi /etc/network/interfaces
# 若设置 DHCP 自动获取 IP 地址,在以上文件中添加
auto eth0
iface eth0 inet dhcp
# 若配置自定义 IP 地址,在以上文件中添加
auto eth0
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1

以上为配置 eth0 网口的两种配置方法,如果接口名不同,替换即可。如 eth1

使配置生效

#重启 networking 服务,让配置生效
sudo /etc/init.d/networking restart
#也可以单独重启 eth0 网口,不影响其它网口运行
sudo ifdown eth0
sudo ifup eth0





posted @ 2011-10-19 22:54  ouuy  阅读(463)  评论(0编辑  收藏  举报