IMPORTANT: Per accedir als fitxer de subversion: http://acacha.org/svn (sense password). Poc a poc s'aniran migrant els enllaços. Encara però funciona el subversion de la farga però no se sap fins quan... (usuari: prova i la paraula de pas 123456)

IMPLEMENTACIÓ D'UN ROUTER (VM PROXMOX)

Rafelmelichproxmoxlogo.png

En aquest exercici implementarem un router a la màquina virtual d'Ubuntu Server creada anteriorment dintre de sistema de virtualització de sistemes PROXMOX ("Node Proxmox05") situat al servidor físic.

Rafelmelichfotoprox1.png

PREPARACIÓ DEL LA MV

HARDWARE

En primera instància afegim 3 targetes de ret a la MV del Proxmox

  • La eth0 a la VLAN17 (aula 20.4)
  • La eth1 a la VLAN24 ADSL -->A la configuració del la targeta de harware al proxmox seleccionem la vmbr 24, que es on esta el rang de servidor Xeba (Internet ADSL). Però com a IP fem servir els rangs de la 20 (172.26.0.6)
  • La eth2 a la VLAN15 (aula 20.2)

Rafelmelichtargetesrouter.png

Afegir Targetes de Xarxa (NIC)

La MV crea per defecte una targeta de xarxa en mode NAT. Per tal de poder realitzar l'exercici correctament haurem d'afegir 3 targetes, en mode bridge (pont).

Per afegir les tagetes a la MV:

1)Seleccionem el node Proxmox on tenim instal·lada la màquina virtual. En el meu cas Proxmox05.
2)Seleccionem la màquina virtual. La meva és la 103 (U.S-1204Rafel).
3)A la finestra de la dreta cliquem sobre la pestanya "Hardware".
  • Ens apareixerà tot el hardware configurat a la MV.
4)Premem "Add" i ens apareixerà un desplegable amb el tipus de hardware que desitgem afegir. Seleccionem "Network Device". Apareixerà una nova targeta.
Rafelmelichnetworkdevuce.png
5)Editem les opcions de configuració de la targeta (Pestanya Edit).
Rafelmelicheditartargeta.png
5.1)Marquem Bridge mode, i a Bridge escollim la VLAN que desitgem per a la interfície. En el cas de l'exemple anterior la VLAN17 -> vmbr17
5.2) VLAN Tag : deixem l'opció per defecte (no VLAN).
5.3) Model: seleccionem VirtIO (paravirtualized).
5.4) MAC address: per defecte.
5.4) Rate limit: per defecte (unlimited).



IP_FORWARD

Abans que res, entrarem a la màquina virtual (Router) i activarem l' IP_FORWARD, així deixarà passar els paquets dirigits a altres màquines.

Activarem el servidor per que faci de router:

Rafelmelichipforward2.jpg


Rafelmelichipforward1.jpg

ESCOLLIREM UNES IP'S LLIURES A LES ANTERIORMENT MENCIONADES VLANS. ¡¡¡PERÒ COMPTE TOTES LES TERMINACIONS AMB 1 DONEN ACCÉS A INTERNET PER FIBRA, DE MANERA QUE ENS DONARIEM ACCÈS A INTERNET SENSE ENRUTAR!!! ESCOLLIR IP'S QUE NO FINALITZIN AMB 1



FITXER /etc/network/interfaces

[email protected]:/$ nano /etc/network/interfaces

  GNU nano 2.2.6                                              Fitxer: /etc/network/interfaces                                                                                                   

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5). 

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
# VLAN17
auto eth0
iface eth0 inet static
        address 192.168.204.118
        netmask 255.255.255.0

# VLAN24
auto eth1
iface eth1 inet static
        address 172.26.0.6
        netmask 255.255.255.248
        gateway 172.26.0.2

# VLAN15
auto eth2
iface eth2 inet static
        address 192.168.202.118
        netmask 255.255.255.0




IFCONFIG PER VISUALITZAR LES TARGETES DE RET


[email protected]:~$ sudo ssh [email protected]
sudo: unable to resolve host Asmodeus
[email protected]'s password: 
Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 3.2.0-38-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Mon Mar  4 20:18:32 CET 2013

  System load:  0.01               Users logged in:     1
  Usage of /:   11.4% of 30.77GB   IP address for eth0: 192.168.204.118
  Memory usage: 9%                 IP address for eth1: 172.26.0.6
  Swap usage:   0%                 IP address for eth2: 192.168.202.118
  Processes:    84

  Graph this data and manage this system at https://landscape.canonical.com/

Last login: Mon Mar  4 20:13:45 2013
[email protected]:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr ce:6a:0c:bb:97:e1                                                                                                                                         
         inet addr:192.168.204.118  Bcast:192.168.204.255  Mask:255.255.255.0                                                                                                                  
          inet6 addr: fe80::cc6a:cff:febb:97e1/64 Scope:Link                                                                                                                                    
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                                                                                                                                    
          RX packets:564 errors:0 dropped:0 overruns:0 frame:0                                                                                                                                  
          TX packets:78 errors:0 dropped:0 overruns:0 carrier:0                                                                                                                                 
          collisions:0 txqueuelen:1000                                                                                                                                                          
          RX bytes:90456 (90.4 KB)  TX bytes:12737 (12.7 KB)                                                                                                                                    
                                                                                                                                                                                                 
eth1      Link encap:Ethernet  HWaddr de:4e:16:36:23:c0                                                                                                                                         
          inet addr:172.26.0.6  Bcast:172.26.0.7  Mask:255.255.255.248                                                                                                                          
          inet6 addr: fe80::dc4e:16ff:fe36:23c0/64 Scope:Link                                                                                                                                   
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                                                                                                                                    
          RX packets:28 errors:0 dropped:0 overruns:0 frame:0                                                                                                                                   
          TX packets:51 errors:0 dropped:0 overruns:0 carrier:0                                                                                                                                 
          collisions:0 txqueuelen:1000                                                                                                                                                           
          RX bytes:1922 (1.9 KB)  TX bytes:8274 (8.2 KB)                                                                                                                                        
                                                                                                                                                                                                 
eth2      Link encap:Ethernet  HWaddr 32:a7:bd:20:ea:51                                                                                                                                         
          inet addr:192.168.202.118  Bcast:192.168.202.255  Mask:255.255.255.0                                                                                                                  
          inet6 addr: fe80::30a7:bdff:fe20:ea51/64 Scope:Link                                                                                                                                   
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                                                                                                                                    
          RX packets:1475 errors:0 dropped:5 overruns:0 frame:0                                                                                                                                 
          TX packets:51 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:265408 (265.4 KB)  TX bytes:8312 (8.3 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:354 errors:0 dropped:0 overruns:0 frame:0
          TX packets:354 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:26940 (26.9 KB)  TX bytes:26940 (26.9 KB)
 


ENS CONNECTEM PER SSH PER TAL DE PODER TREBALLAR MILLOR A LA MÀQUINA.

[email protected]:~$ sudo ssh [email protected]
sudo: unable to resolve host Asmodeus
[sudo] password for rafelmelich: 
[email protected]'s password: 
Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 3.2.0-38-generic x86_64)
 
 * Documentation:  https://help.ubuntu.com/

  System information as of Mon Mar  4 20:47:32 CET 2013

  System load:  0.0                Users logged in:     1
  Usage of /:   11.4% of 30.77GB   IP address for eth0: 192.168.204.118
  Memory usage: 9%                 IP address for eth1: 172.26.0.6
  Swap usage:   0%                 IP address for eth2: 192.168.202.118
  Processes:    82

  Graph this data and manage this system at https://landscape.canonical.com/

Last login: Mon Mar  4 20:18:33 2013 from asmodeus.local



COMPROVEM QUE ARRIBEM A LEA IP'S DE LES TARGETES (GATEWAYS INCLUSSIVE):


[email protected]:~$ ping 192.168.204.118   -->ping IP targeta eth0 (aula 20.4- vlan17)
PING 192.168.204.118 (192.168.204.118) 56(84) bytes of data.
64 bytes from 192.168.204.118: icmp_req=1 ttl=64 time=0.022 ms
64 bytes from 192.168.204.118: icmp_req=2 ttl=64 time=0.026 ms

--- 192.168.204.118 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.022/0.024/0.026/0.002 ms

[email protected]:~$ ping 192.168.204.1   -->ping ip gateway aula 20.4 vlan17
PING 192.168.204.1 (192.168.204.1) 56(84) bytes of data.
64 bytes from 192.168.204.1: icmp_req=1 ttl=64 time=0.473 ms
64 bytes from 192.168.204.1: icmp_req=2 ttl=64 time=0.165 ms
^C
--- 192.168.204.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.165/0.319/0.473/0.154 ms

[email protected]:~$ ping 172.26.0.6  --> ping eth1 vlan20 xeva adsl
PING 172.26.0.6 (172.26.0.6) 56(84) bytes of data.
64 bytes from 172.26.0.6: icmp_req=1 ttl=64 time=0.024 ms
64 bytes from 172.26.0.6: icmp_req=2 ttl=64 time=0.026 ms
^C
--- 172.26.0.6 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.024/0.025/0.026/0.001 ms
 
[email protected]:~$ ping 172.26.0.2   -->ping gateway eth1 vlan20 adsl (xeva)
PING 172.26.0.2 (172.26.0.2) 56(84) bytes of data.
64 bytes from 172.26.0.2: icmp_req=1 ttl=255 time=1.01 ms
64 bytes from 172.26.0.2: icmp_req=2 ttl=255 time=1.00 ms
^C
--- 172.26.0.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 1.009/1.011/1.013/0.002 ms
[email protected]:~$ ping 192.168.202.118
PING 192.168.202.118 (192.168.202.118) 56(84) bytes of data.
64 bytes from 192.168.202.118: icmp_req=1 ttl=64 time=0.024 ms
64 bytes from 192.168.202.118: icmp_req=2 ttl=64 time=0.023 ms
64 bytes from 192.168.202.118: icmp_req=3 ttl=64 time=0.021 ms
64 bytes from 192.168.202.118: icmp_req=4 ttl=64 time=0.028 ms
64 bytes from 192.168.202.118: icmp_req=5 ttl=64 time=0.024 ms
64 bytes from 192.168.202.118: icmp_req=6 ttl=64 time=0.029 ms
^C
--- 192.168.202.118 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 4998ms
rtt min/avg/max/mdev = 0.021/0.024/0.029/0.007 ms


[email protected]:~$ ping 192.168.202.118  --> ping ip aula 20.2 eth2
PING 192.168.202.118 (192.168.202.118) 56(84) bytes of data.
64 bytes from 192.168.202.118: icmp_req=1 ttl=64 time=0.021 ms
64 bytes from 192.168.202.118: icmp_req=2 ttl=64 time=0.031 ms
^C
--- 192.168.202.118 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.021/0.026/0.031/0.005 ms


[email protected]:~$ ping 192.168.202.1  -->ping ip gateway  eth2 vlan15 (aula 20.2)
PING 192.168.202.1 (192.168.202.1) 56(84) bytes of data.
64 bytes from 192.168.202.1: icmp_req=1 ttl=64 time=0.352 ms
64 bytes from 192.168.202.1: icmp_req=2 ttl=64 time=0.166 ms
^C
--- 192.168.202.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.166/0.259/0.352/0.093 ms
[email protected]:~$ 







MAQUINA CLIENT:

[email protected]:~$ ifconfig
eth4      Link encap:Ethernet  HWaddr 08:00:27:44:e6:9c  
          inet addr:192.168.204.241  Bcast:192.168.204.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe44:e69c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7932 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2674 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2058730 (2.0 MB)  TX bytes:298004 (298.0 KB)

eth5      Link encap:Ethernet  HWaddr 08:00:27:a0:46:e9  
          inet6 addr: fe80::a00:27ff:fea0:46e9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:102 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:18153 (18.1 KB) 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:79 errors:0 dropped:0 overruns:0 frame:0
          TX packets:79 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:8399 (8.3 KB)  TX bytes:8399 (8.3 KB)




[email protected]:/etc/iproute2$ sudo ip route show table main
default via 172.26.0.2 dev eth1  metric 100 
169.254.0.0/16 dev eth0  scope link  metric 1000 
172.26.0.0/29 dev eth1  proto kernel  scope link  src 172.26.0.6 
192.168.202.0/24 dev eth2  proto kernel  scope link  src 192.168.202.118 
192.168.204.0/24 dev eth0  proto kernel  scope link  src 192.168.204.118  

[email protected]:/etc/iproute2$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.26.0.2      0.0.0.0         UG    100    0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0
172.26.0.0      0.0.0.0         255.255.255.248 U     0      0        0 eth1
192.168.202.0   0.0.0.0         255.255.255.0   U     0      0        0 eth2
192.168.204.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0



  GNU nano 2.2.6                                            Fitxer: rt_tables                                                                                                

#
# reserved values
#
255     local
254     main
253     default
0       unspec
#
# local
#
#1      inr.ruhep
200     internet1
201     internet2
                                                              [ Read 13 lines (Warning: No write permission) ]
^G Ajuda                    ^O Desa                     ^R Llegeix                  ^Y Pàg Ant                  ^K Retalla                  ^C Pos Act
^X Surt                     ^J Justifica                ^W Cerca                    ^V Pàg Seg                  ^U Destalla el text         ^T Ortografia




CREEM UNA TAULA ANOMENDA RAFEL PROXMOX

[email protected]:~$ sudo nano /etc/iproute2/rt_tables

  GNU nano 2.2.6                                       Fitxer: /etc/iproute2/rt_tables                                                                                       

#
# reserved values
#
255     local
254     main
253     default
0       unspec
#
# local
#
#1      inr.ruhep
200     rafelproxmox
 
                                                                          [ 12 línies llegides ]
^G Ajuda                    ^O Desa                     ^R Llegeix                  ^Y Pàg Ant                  ^K Retalla                  ^C Pos Act
^X Surt                     ^J Justifica                ^W Cerca                    ^V Pàg Seg                  ^U Destalla el text         ^T Ortografia

-----------------------------------------------------------------------------------------

A continuació executem la comanda flush perquè el nostre sistema apliqui la ruta afegida:

[email protected]:~$ sudo ip route flush table rafelproxmox

consultem la taula de rutes (serà la main)

[email protected]:~$ sudo ip route show
default via 172.26.0.2 dev eth1  metric 100 
169.254.0.0/16 dev eth1  scope link  metric 1000 
172.26.0.0/29 dev eth1  proto kernel  scope link  src 172.26.0.6 
192.168.202.0/24 dev eth2  proto kernel  scope link  src 192.168.202.118 
192.168.204.0/24 dev eth0  proto kernel  scope link  src 192.168.204.118


Consultem la taula de rutes rafelproxmox

[email protected]:~$ sudo ip route show table rafelproxmox
[email protected]:~$ 
  • Apareix en blanc perquè encara no l'hem omplida.

Per afegir una ruta nova a la taula, utilitzem la comanda add. Afegim el gateway amb aquesta comanda:

[email protected]:~$ sudo ip route add default via 172.26.0.2 dev eth1 proto static table rafelproxmox

Afegim la xarxa amb la mateixa comanda:

[email protected]:~$ sudo ip route add 172.26.0.0/29 dev eth1 proto kernel scope link src 172.26.0.6 table rafelproxmox


Quan hem afegit el gateway i la xarxa, podem establir la nova norma:

[email protected]:~$ sudo ip rule add from 192.168.204.241 lookup rafelproxmox


Fem un cop d'ull a les normes:

[email protected]:~$ sudo ip rule show
0:      from all lookup local 
32765:  from 192.168.204.241 lookup rafelproxmox 
32766:  from all lookup main 
32767:  from all lookup default 



A continuació, per fer les proves, canvio la porta d'enllaç del meu client per la IP del meu servidor proxmox: Primer esborro la porta d'enllaç de l'aula:

[email protected]:~$ ifconfig
eth4      Link encap:Ethernet  HWaddr 08:00:27:44:e6:9c  
          inet addr:192.168.204.241  Bcast:192.168.204.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe44:e69c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2614 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1321 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:342180 (342.1 KB)  TX bytes:123253 (123.2 KB)

eth5      Link encap:Ethernet  HWaddr 08:00:27:a0:46:e9  
          inet6 addr: fe80::a00:27ff:fea0:46e9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:12328 (12.3 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:174 (174.0 B)  TX bytes:174 (174.0 B)

[email protected]:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.204.1   0.0.0.0         UG    0      0        0 eth4
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth4
192.168.204.0   0.0.0.0         255.255.255.0   U     1      0        0 eth4
[email protected]:~$ sudo route del default gw 192.168.204.1
[sudo] password for rafelmelich: 

[email protected]:~$ sudo route add default gw 192.168.204.118
[email protected]:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.204.118 0.0.0.0         UG    0      0        0 eth4
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth4
192.168.204.0   0.0.0.0         255.255.255.0   U     1      0        0 eth4



Ara s'ha de crear a la màquina del servidor una norma de NAT:

[email protected]:~$ sudo iptables -t nat -A POSTROUTING -s 192.168.204.0/24 -j MASQUERADE

Comprovo la taula NAT: (FOTO)

[email protected]:~$ traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
 1  * * *
 2  * * *
 3  * * *
 4  * * *
 5  * 83.247.145.9 (83.247.145.9)  50.254 ms  52.010 ms
 6  83.247.145.1 (83.247.145.1)  53.138 ms  50.331 ms  51.600 ms
 7  213.192.249.158 (213.192.249.158)  52.234 ms  50.713 ms  50.791 ms
 8  213.192.249.157 (213.192.249.157)  50.954 ms  50.421 ms  55.068 ms
 9  212.80.161.81 (212.80.161.81)  50.196 ms  49.712 ms  49.965 ms
10  212.80.160.97 (212.80.160.97)  62.062 ms  61.962 ms  63.660 ms
11  212.80.160.241 (212.80.160.241)  62.349 ms  62.989 ms  62.351 ms
12  * * *
13  193.149.1.94 (193.149.1.94)  64.804 ms  66.194 ms  66.188 ms
14  216.239.49.230 (216.239.49.230)  76.086 ms 216.239.49.196 (216.239.49.196)  78.373 ms *
15  209.85.240.191 (209.85.240.191)  92.948 ms 209.85.240.189 (209.85.240.189)  97.801 ms  99.600 ms


[email protected]:~$ traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
 1  * * *
 2  * * *
 3  * * *
 4  * * *
 5  * 83.247.145.9 (83.247.145.9)  50.254 ms  52.010 ms
 6  83.247.145.1 (83.247.145.1)  53.138 ms  50.331 ms  51.600 ms
 7  213.192.249.158 (213.192.249.158)  52.234 ms  50.713 ms  50.791 ms
 8  213.192.249.157 (213.192.249.157)  50.954 ms  50.421 ms  55.068 ms
 9  212.80.161.81 (212.80.161.81)  50.196 ms  49.712 ms  49.965 ms
10  212.80.160.97 (212.80.160.97)  62.062 ms  61.962 ms  63.660 ms
11  212.80.160.241 (212.80.160.241)  62.349 ms  62.989 ms  62.351 ms
12  * * *
13  193.149.1.94 (193.149.1.94)  64.804 ms  66.194 ms  66.188 ms
14  216.239.49.230 (216.239.49.230)  76.086 ms 216.239.49.196 (216.239.49.196)  78.373 ms *
15  209.85.240.191 (209.85.240.191)  92.948 ms 209.85.240.189 (209.85.240.189)  97.801 ms  99.600 ms


[email protected]:~$ route -n   --->BONA
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.204.118 0.0.0.0         UG    0      0        0 eth4
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth4
192.168.204.0   0.0.0.0         255.255.255.0   U     1      0        0 eth4
 
[email protected]:~$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=41 time=80.0 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=41 time=80.0 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=41 time=68.0 ms
64 bytes from 8.8.8.8: icmp_req=4 ttl=41 time=80.0 ms
64 bytes from 8.8.8.8: icmp_req=5 ttl=41 time=92.0 ms
64 bytes from 8.8.8.8: icmp_req=6 ttl=41 time=80.0 ms
^C
--- 8.8.8.8 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5054ms
rtt min/avg/max/mdev = 68.038/80.045/92.052/6.932 ms

[email protected]:~$ traceroute 8.8.8.8 -n
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
 1  192.168.204.118  0.000 ms  0.000 ms  0.000 ms
 2  85.192.120.9  16.009 ms  16.009 ms  16.009 ms
 3  10.19.41.1  60.034 ms  60.034 ms  60.034 ms
 4  213.176.160.154  64.036 ms  64.036 ms  64.036 ms
 5  213.176.160.4  64.036 ms  64.036 ms  64.036 ms
 6  83.247.145.9  64.036 ms  44.024 ms  44.024 ms
 7  83.247.145.1  44.024 ms  36.020 ms  40.023 ms
 8  213.192.249.158  40.023 ms  52.029 ms  52.029 ms
 9  213.192.249.157  52.029 ms  56.031 ms  56.031 ms
10  212.80.161.81  56.031 ms  60.033 ms  60.033 ms
11  212.80.160.97  72.040 ms  72.040 ms  72.040 ms
12  212.80.160.241  92.051 ms  92.051 ms  92.052 ms
13  * * *
14  193.149.1.94  80.045 ms  76.043 ms  76.043 ms
15  216.239.49.196  76.043 ms  80.045 ms  80.045 ms
16  209.85.240.191  84.047 ms 209.85.240.189  92.052 ms 209.85.240.191  88.050 ms
17  72.14.235.16  88.050 ms  100.056 ms  100.056 ms
18  209.85.254.112  84.047 ms 209.85.254.116  84.047 ms  88.049 ms
19  * * *
20  8.8.8.8  84.048 ms  80.045 ms  76.042 ms

[email protected]:~$ traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
 1  a204PC18.aula204.iesebre.com (192.168.204.118)  0.000 ms  4.002 ms  4.002 ms
 2  iesebre.xtec.cat (85.192.120.9)  4.002 ms  4.002 ms  4.002 ms
 3  10.19.41.1 (10.19.41.1)  48.027 ms  48.027 ms  48.027 ms
 4  213.176.160.154 (213.176.160.154)  188.106 ms  188.106 ms  188.106 ms
 5  llenep.xtec.cat (213.176.160.4)  72.041 ms  72.041 ms  72.041 ms

Ara canvio la gateway per defecte del servidor perquè surti per un altra IP:

[email protected]:~$ sudo route del default gw 172.26.0.2
[email protected]:~$ sudo ip rule show
0:      from all lookup local 
32765:  from 192.168.204.241 lookup rafelproxmox 
32766:  from all lookup main 
32767:  from all lookup default 

[email protected]:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth1
172.26.0.0      0.0.0.0         255.255.255.248 U     0      0        0 eth1
192.168.202.0   0.0.0.0         255.255.255.0   U     0      0        0 eth2
192.168.204.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

[email protected]:~$ sudo route add default gw 172.26.0.2
[email protected]:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.26.0.2      0.0.0.0         UG    0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth1
172.26.0.0      0.0.0.0         255.255.255.248 U     0      0        0 eth1
192.168.202.0   0.0.0.0         255.255.255.0   U     0      0        0 eth2
192.168.204.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

[email protected]:~$ sudo route add default gw 172.26.0.2
SIOCADDRT: El fitxer ja existeix

[email protected]:~$ sudo route del default gw 172.26.0.2
[email protected]:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth1
172.26.0.0      0.0.0.0         255.255.255.248 U     0      0        0 eth1
192.168.202.0   0.0.0.0         255.255.255.0   U     0      0        0 eth2
192.168.204.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0


[email protected]:~$ sudo route add default gw 172.168.202.1
SIOCADDRT: El procés no existeix
[email protected]:~$ sudo route add default gw 192.168.202.1
[email protected]:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.202.1   0.0.0.0         UG    0      0        0 eth2
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth1
172.26.0.0      0.0.0.0         255.255.255.248 U     0      0        0 eth1
192.168.202.0   0.0.0.0         255.255.255.0   U     0      0        0 eth2
192.168.204.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

[email protected]:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.26.0.2      0.0.0.0         UG    0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth1
172.26.0.0      0.0.0.0         255.255.255.248 U     0      0        0 eth1
192.168.202.0   0.0.0.0         255.255.255.0   U     0      0        0 eth2
192.168.204.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

[email protected]:~$ sudo route del default gw 172.26.0.2
[email protected]:~$ sudo route del default gw 192.168.202.1
SIOCDELRT: El procés no existeix
[email protected]:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth1
172.26.0.0      0.0.0.0         255.255.255.248 U     0      0        0 eth1
192.168.202.0   0.0.0.0         255.255.255.0   U     0      0        0 eth2
192.168.204.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

[email protected]:~$ sudo route add default gw 192.168.202.1
[email protected]:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.202.1   0.0.0.0         UG    0      0        0 eth2
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth1
172.26.0.0      0.0.0.0         255.255.255.248 U     0      0        0 eth1
192.168.202.0   0.0.0.0         255.255.255.0   U     0      0        0 eth2
192.168.204.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0
[email protected]:~$ 


[email protected]:~$ traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
 1  a204PC18.aula204.iesebre.com (192.168.204.118)  0.000 ms  4.002 ms  4.002 ms
 2  iesebre.xtec.cat (85.192.120.9)  4.002 ms  4.002 ms  4.002 ms
 3  10.19.41.1 (10.19.41.1)  48.027 ms  48.027 ms  48.027 ms
 4  213.176.160.154 (213.176.160.154)  188.106 ms  188.106 ms  188.106 ms
 5  llenep.xtec.cat (213.176.160.4)  72.041 ms  72.041 ms  72.041 ms