Monday, 17 September 2012

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.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Interview questions: 2020-12

Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer  Networking Layer 1 vs Layer 4 haproxy u...