Skip to content

Instantly share code, notes, and snippets.

@JonnyTech
Last active July 7, 2023 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonnyTech/bd232f218861ce7f2f8e25b0b1049eeb to your computer and use it in GitHub Desktop.
Save JonnyTech/bd232f218861ce7f2f8e25b0b1049eeb to your computer and use it in GitHub Desktop.
MacOS VLANs

Linux:

vconfig add en0 3
ip addr add 192.168.126.5/24 dev en0.3
ip link set up en0.3

macOS:

ifconfig vlan0 create
ifconfig vlan0 vlan 3 vlandev en0
ifconfig vlan0 inet 192.168.126.5 netmask 255.255.255.0

DHCP:

ipconfig set vlan0 DHCP

Removal:

ifconfig vlan0 destroy

networksetup:

[-createVLAN name parentdevice tag]
[-deleteVLAN name parentdevice tag] [-listVLANs]
[-listdevicesthatsupportVLAN]
[-isBondSupported device]
[-createBond name [device1] [device2] [...]] [-deleteBond bond]
[-addDeviceToBond device bond]
[-removeDeviceFromBond device bond] [-listBonds]
[-showBondStatus bond]

-createVLAN name parentdevice tag
Create a VLAN with the name <name> over the parent device <parentdevice> and with the tag <tag>.
-deleteVLAN name parentdevice tag
Delete the VLAN with the name <name> over the parent device <parentdevice> and with the tag <tag>.
-listVLANs
List the VLANs that have been created.
-listdevicesthatsupportVLAN
List the devices that support VLANs.

sudo networksetup -createVLAN LAN Ethernet 1
sudo networksetup -setmanual LAN\ Configuration 10.0.0.1 255.255.255.0 10.0.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment