- Turn off all "Network Manager" type processes and applications
- Comment out /etc/network/interfaces entries even
- Do all commands as the root user
- Monitoring changes
- In one terminal, run this command and watch it as you execute the commands below to see what is changing
- sudo watch -d 'ip addr;echo =====;ip link;echo =====;ip route'
- Add VLAN
- ip link add link eth0 name eth0.20 type vlan id 20
- ip link set dev eth0 up
- ip link set dev eth0.20 up
- ip addr add 192.168.20.190/24 dev eth0.20
- ip route add default via 192.168.20.1
- For any other VLANs, change the "20" in the commands above to the desired VLAN, e.g.
- ip link add link eth0 name eth0.100 type vlan id 100
- Delete VLAN
- ip link delete eth0.20
- Abstract commands
- Create
- ip addr add IP/NETMASK dev INTERFACE.VID
- ip link set dev INTERFACE.VID up
- ip addr add 192.168.100.101/24 dev eth0.100
- ip link set dev eth0.100 up
- Destroy
- ip link set dev INTERFACE.VID down
- ip link set dev eth0.100 down
- ip link delete INTERFACE.VID
- ip link delete eth0.100
- Notes
- Network addr does not have to match the VLAN name
- VLAN name is arbitrary, you can call it "joe" if you'd like
- http://www.linuxjournal.com/article/7268
- "Trunks using the 802.1q protocol work by adding a 4-byte VLAN identifier to each frame"
- "When a switch receives a tagged unicast frame, it looks up the outgoing port using both the destination MAC address and the VLAN identifier"
- "When a broadcast frame is received, it is flooded out to all active ports participating in that VLAN"
Showing posts with label iproute. Show all posts
Showing posts with label iproute. Show all posts
Saturday, 29 September 2012
VLAN on Linux CLI
Monday, 17 September 2012
VLANs with iproute on CLI
Set up VLAN "20" on eth0
- Base
- ip link add link eth0 name eth0.20 type vlan id 20
- ip link set dev eth0 up
- ip link set dev eth0.20 up
- Manually assign
- ip addr add 192.168.20.100/24 dev eth0.20
- ip route add 192.168.20.0/24 dev eth0.20
- ip route add default via 192.168.20.1
- ip route delete 192.168.20.0/24 dev eth0.20
- ip link set dev eth0.20 down
- ip link delete eth0.20
Subscribe to:
Posts (Atom)
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...
-
kubectl --cert=/tmp/tls.crt --key=/tmp/tls.key create secret tls tls-wc-ingress
-
apt-get install exim4 dpkg-reconfigure exim4-config Select: internet site; mail is sent and received directly using SMTP IP-addresses...
-
NOTE: unbound is now available via epel repo on Amazon Linux install requirements yum groupinstall "Development Tools" yum i...