linux下网络接口参数配置
网络接口参数配置文件,下面是一个配置示例,它在一个网络接口中配置了两个静态IP地址:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)# The loopback interfaceauto loiface lo inet loopback# The first network card - this entry was created during the Debian installation# (network, broadcast and gateway are optional)auto eth0iface 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:0iface 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 interfaceauto loiface lo inet loopback# The first network card - this entry was created during the Debian installation# (network, broadcast and gateway are optional)auto eth0iface eth0 inet dhcp