重启网络命令:sudo /etc/init.d/networking restart
修改网络配置:sudo vi /etc/network/interfaces
具体文件参考:http://man.chinaunix.net/linux/debian/debian_learning/ch11s12.html
接口参数配置文件,下面是一个配置示例,它在一个网络接口中配置了两个静态IP地址:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) # The loopback interface auto lo iface lo inet loopback # The first network card - this entry was created during the Debian installation # (network, broadcast and gateway are optional) auto eth0 iface eth0 inet static address 192.168.1.1 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 # gateway 192.168.1.1 # name 以太网局域网网卡 auto eth0:0 iface eth0:0 inet static address 192.168.1.2 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1
下面是一个从DHCP服务器自动获得IP地址的示例:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) # The loopback interface auto lo iface lo inet loopback # The first network card - this entry was created during the Debian installation # (network, broadcast and gateway are optional) auto eth0 iface eth0 inet dhcp
临时修改mark地址:
sudo ifconfig
sudo ifconfig eth0 down
sudo ifconfig eth0 hw ether 00:1B:38:C0:C5:40
sudo ifconfig eth0 up
sudo /etc/init.d/networking restart
关闭和启动网卡
sudo ifdown eth0
sudo ifup eth0
有可能需要配置域名解析 /etc/resolve.conf文件
参考:http://man.chinaunix.net/linux/debian/debian_learning/ch11s13.html
该文件是DNS域名解析的配置文件,它的格式很简单,每行以一个关键字开头,后接配置参数。resolv.conf的关键字主要有四个,分别是:
nameserver #定义DNS服务器的IP地址 domain #定义本地域名 search #定义域名的搜索列表 sortlist #对返回的域名进行排序
/etc/resolv.conf的一个示例:
domain ringkee.com
search www.ringkee.com ringkee.com nameserver 202.96.128.86 nameserver 202.96.128.166
最主要是nameserver关键字,如果没指定nameserver就找不到DNS服务器,其它关键字是可选的