Virtual network interface in Mac OS X

前端 未结 12 2288
礼貌的吻别
礼貌的吻别 2020-12-12 10:15

I know that you can make a virtual network interface in Windows (see here), and in Linux it is also pretty easy with ip-aliases, but does something similar exist for Mac OS

12条回答
  •  旧巷少年郎
    2020-12-12 11:09

    A few others seemed to hint at this, but the following demonstrates using ifconfig to create a vlan and test DNS on the virtual interface (using minidns) on OS X 10.9.5:

    $ sw_vers -productVersion
    10.9.5
    $ sudo ifconfig vlan169 create && echo vlan169 created
    vlan169 created
    $ sudo ifconfig vlan169 inet 169.254.169.254 netmask 255.255.255.255 && echo vlan169 configured
    vlan169 configured
    $ sudo ./minidns.py 169.254.169.254 &
    [1] 35125
    $ miniDNS :: * 60 IN A 169.254.169.254
    
    
    $ dig @169.254.169.254 +short test.host
    Request: test.host. -> 169.254.169.254
    Request: test.host. -> 169.254.169.254
    169.254.169.254
    $ sudo kill 35125
    $ 
    [1]+  Exit 143                sudo ./minidns.py 169.254.169.254
    $ sudo ifconfig vlan169 destroy && echo vlan169 destroyed
    vlan169 destroyed
    

提交回复
热议问题