VLANs with iproute on CLI

Set up VLAN "20" on eth0
  1. Base
    1. ip link add link eth0 name eth0.20 type vlan id 20
    2. ip link set dev eth0 up
    3. ip link set dev eth0.20 up
  2. Manually assign
    1. ip addr add 192.168.20.100/24 dev eth0.20
    2. ip route add 192.168.20.0/24 dev eth0.20
    3. ip route add default via 192.168.20.1
Delete
  1. ip route delete 192.168.20.0/24 dev eth0.20
  2. ip link set dev eth0.20 down
  3. ip link delete eth0.20
Notes: "name" may be anything you wish, but then in subsequent commands, you must use it, which can be a bit hard to spot. Take a look at "eth0.20", and try changing it to a random string for testing.

Comments

Popular posts from this blog

Openvpn and unbound combined break dig command

Stress Linux system: stress-ng

Google Nexus 4: permanent back panel glass repair for less than a penny