FreeBSD下给网卡设置两个IP

今天需要在FreeBSD下给网卡设置两个IP,特记录一下:

   编辑 /etc/rc.conf,在

ifconfig_em0="inet 172.16.27.23 netmask 255.255.255.224"
    
     下添加如下:

ifconfig_em0_alias0="inet 172.16.27.22 netmask 255.255.255.224"


   重启设置:

/etc/netstart



em0: flags=8843 <UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=9b <RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        ether 00:0c:29:9b:56:67
        inet 172.16.27.23 netmask 0xffffffe0 broadcast 172.16.27.31
        inet 172.16.27.22 netmask 0xffffffe0 broadcast 172.16.27.31
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active

已经设置为172.16.27.23和172.16.27.22 两个IP

你可能感兴趣的:(同网卡两个IP)