Skip to content

Instantly share code, notes, and snippets.

@johscheuer
Created December 2, 2016 09:49
Show Gist options
  • Save johscheuer/4b2b156946bdf9e9cf6244cfea999b6a to your computer and use it in GitHub Desktop.
Save johscheuer/4b2b156946bdf9e9cf6244cfea999b6a to your computer and use it in GitHub Desktop.
modinfo 8021q
echo "8021q" >> /etc/modules
# last digest e.g. tb37 -> 37
IP=37
echo ${IP}
# Controll Network
tee /etc/sysconfig/network-scripts/enp4s0f1.101 <<-'EOF'
DEVICE=enp4s0f1.101
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.11.${IP}
PREFIX=24
NETWORK=192.168.11.0
VLAN=yes
EOF
tee /etc/sysconfig/network-scripts/enp4s0f1.102 <<-'EOF'
DEVICE=enp4s0f1.102
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.12.${IP}
PREFIX=24
NETWORK=192.168.12.0
VLAN=yes
EOF
tee /etc/sysconfig/network-scripts/enp4s0f1.103 <<-'EOF'
DEVICE=enp4s0f1.103
BOOTPROTO=none
ONBOOT=yes
IPADDR=172.10.0.${IP}
PREFIX=24
NETWORK=172.10.0.0
VLAN=yes
EOF
systemctl restart network
# Validate
ip -d link show enp4s0f1.101
ip -d link show enp4s0f1.102
ip -d link show enp4s0f1.103
# Show routes
ip route list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment