今日有人问到ubuntu在命令行界面怎么设置网络IP,以便上网,这里就补充一下:
设置IP
sudo vi /etc/network/interfaces
内容:
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
# iface eth0 inet dhcp 这样是DHCP来分配
# iface eth0 inet manual 这样是手动设置网卡,不启用网卡
iface eth0 inet static
address 172.18.41.212
netmask 255.255.255.0
broadcast 172.18.41.255
gateway 172.18.41.254
dns-nameservers 8.8.8.8 #这里是dns-nameserver ,不要只写成nameserver了!这里的记录会自动追加到/etc/resolv.conf
重启网络
sudo invoke-rc.d networking restart
补充debian wiki的网络配置:http://wiki.debian.org/NetworkConfiguration
很好,回去试试!