Linux router with VLANs

If you need to set up a router with C-VLAN encapsulation for you debug/testing purposes, it is easily to make it on Linuc PC.
The example below is for Dedian-Linux to setup IPv4 routing with C-VLAN 100 between Eth1 and Eth2 Linux interfaces :

### IPv4 Routing turn on

- Edit /etc/sysctl

net.ipv4.conf.eth2.forwarding = 1
net.ipv4.conf.eth1.forwarding = 1
net.ipv4.conf.lo.forwarding = 1


- Execute sysctl –p command (apply the parameters above)

- Configure network interfaces:

modprobe 8021q
vconfig add eth1 100
ip addr add dev eth1.100 10.10.10.1/24
ip link set dev eth1.100 up

vconfig add eth2 100
ip addr add dev eth2.100 172.16.0.1/24
ip link set dev eth2.100 up

No comments:

Post a Comment