Ubuntu 8.10 默认是gnome,默认是DHCP自动获取IP。设定好静态IP,重启了也会变。 1。设定IP sudo gedit /etc/network/interfaces auto lo iface lo inet loopback #lo 是本地回环地址:127.1 auto eth0 iface eth0 inet static address 192.168.1.152 gateway 192.168.1.1 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 #设定eth0的IP 这样,IP并没有立即生效。 sudo /etc/init.d/networking restart 2。这时候就能ping到局域网中的电脑了。但是上不了Internet,是因为没有设置DNS的原因。DNS信息保存在/etc/resolv.conf中,一旦更改,立即生效。 sudo gedit /etc/resolv.conf nameserver 208.67.222.222 nameserver 208.67.220.220 现在可以上网了。 附网卡设置相关命令: 查看网卡信息: ifconfig 设定一个网卡IP:ifconfig eth1 192.168.1.10 netmask 255.255.255.0 重启网卡使设定生效:sudo /etc/init.d/networking restart 更改MAC地址:ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx 查看路由相关信息:route -n |
|
来自: su_day > 《linux基本配置》