Skip to content

Instantly share code, notes, and snippets.

@tiagocoutinho
Last active May 13, 2020 19:24
Show Gist options
  • Save tiagocoutinho/9997cc984d3cb51b0896a71a5b34dafb to your computer and use it in GitHub Desktop.
Save tiagocoutinho/9997cc984d3cb51b0896a71a5b34dafb to your computer and use it in GitHub Desktop.
virtual local network
# Execute with sudo
# Recipe at: https://unix.stackexchange.com/questions/152331/how-can-i-create-a-virtual-ethernet-interface-on-a-machine-without-a-physical-ad
NAME=bl04-eth
ALIAS=$NAME:0
MAC=00:22:22:ff:ff:ff
IP=192.168.100.199
# Create interface
ip link add $NAME type dummy
# Change MAC
ifconfig eth10 hw ether $MAC
# Create an alias
sudo ip addr add $IP/24 brd + dev $NAME label $ALIAS
ip link show $NAME
# optionaly add in your /etc/hosts:
# $IP bl04cryocon bl04mythen
# Execute with sudo
NAME=bl04-eth
ALIAS=$NAME:0
MAC=00:22:22:ff:ff:ff
IP=192.168.100.199
sudo ip addr del $IP/24 brd + dev $NAME label $ALIAS
sudo ip link delete $NAME type dummy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment