MUNTATGE
Em afegit al ordinador sobretaula (router físic) un tarjeta de xarxa adicional com aquesta
CONFIGURACIÓ
La configuració que hem utilitzat per el router es el següent
1 → Obrim la terminal i afegim les següent comandes
sudo nano etc/network/interfaces
auto enp2s0
iface enp2s0 inet manual
auto eno1
iface eno1 inet static
address 172.25.208.20
netmask 255.255.0.0
gateway 172.25.130.254
# XARXA 1 – VLAN 10
auto enp2s0.10
iface enp2s0.10 inet static
address 10.0.10.1
netmask 255.255.255.192
vlan-raw-device enp2s0
gateway 10.0.10.62
# XARXA 2 – VLAN 20
auto enp2s0.20
iface enp2s0.20 inet static
address 10.0.10.65
netmask 255.255.255.192
vlan-raw-device enp2s0
gateway 10.0.10.126
# XARXA 3 – VLAN 30
auto enp2s0.30
iface enp2s0.30 inet static
address 10.0.10.129
netmask 255.255.255.240
vlan-raw-device enp2s0
gateway 10.0.10.142
# XARXA 4 – VLAN 40
auto enp2s0.40
iface enp2s0.40 inet static
address 10.0.10.145
netmask 255.255.255.240
vlan-raw-device enp2s0
gateway 10.0.10.158
# XARXA EXTERNA – VLAN 50
#auto enp2s0.50
#iface enp2s0.50 inet static
# address 172.25.208.20
# netmask 255.255.255.0
# vlan-raw-device enp2s0
# gateway 172.25.130.254
2 → Ara tanquem el arxiu i afegim les següents commands pel enrutament
sudo iptables -A FORWARD -i enp2s0 -o enp2s0 -j ACCEPT
sudo iptables -A FORWARD -i enp2s0 -o eno1 -j ACCEPT
sudo iptables -t nat -A POSTROUTING -o eno1 -j MASQUERADE
sudo sysctl -w net.ipv4.ip_forward=1