Was this page helpful?

Ifconfig

    ifconfig 控制網路介面卡的相關指令

    列出所有網路介面

    # ifconfig
    
    gem0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
            options=8<VLAN_MTU>
            inet 192.168.1.120 netmask 0xffffff00 broadcast 192.168.1.255
            ether 00:02:11:90:03:9c
            media: Ethernet autoselect (100baseTX <full-duplex>)
            status: active
    fwe0: flags=108802<BROADCAST,SIMPLEX,MULTICAST,NEEDSGIANT> mtu 1500
            options=8<VLAN_MTU>
            ether 02:02:11:90:03:9c
            ch 1 dma -1
    lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
            inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
            inet6 ::1 prefixlen 128
            inet 127.0.0.1 netmask 0xff000000
    

    增加另外的 IP Address

    # ifconfig em1 inet 192.168.0.10 alias
    # ifconfig
    
    gem0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
            options=8<VLAN_MTU>
            inet 192.168.1.120 netmask 0xffffff00 broadcast 192.168.1.255
            inet 192.168.1.100 netmask 0xffffff00 broadcast 192.168.1.255
            ether 00:02:11:90:03:9c
            media: Ethernet autoselect (100baseTX <full-duplex>)
            status: active
    

    取消另外的 IP Address

    # ifconfig gem0 inet 192.168.1.100 -alias
    # ifconfig
    
    gem0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
            options=8<VLAN_MTU>
            inet 192.168.1.120 netmask 0xffffff00 broadcast 192.168.1.255
            ether 00:02:11:90:03:9c
            media: Ethernet autoselect (100baseTX <full-duplex>)
            status: active 
    
    Was this page helpful?
    標籤 (Edit tags)
    • No tags
    blog comments powered by Disqus
    Powered by MindTouch Core