Menghapus Routing Table Utama di Linux

Jadi begini, saya lagi main-main virt-manager, membuat interface Bridge (br1) untuk disambungkan ke mesin virtual dengan QEMU.

iface br1 inet static
   address 10.10.10.11
   gateway 10.10.10.1
   bridge_ports virbr0-nic enp1s0
   bridge_stp on
   bridge_fd 0.0

dan di interface Wireless (wlp2s0) saya hubungkan dengan tethering ponsel, jadinya tabel routingnya seperti ini :

samsul@studio:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.10.10.1      0.0.0.0         UG    0      0        0 br1
0.0.0.0         192.168.43.1    0.0.0.0         UG    600    0        0 wlp2s0
10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 br1
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 virbr0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
192.168.43.0    0.0.0.0         255.255.255.0   U     600    0        0 wlp2s0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

Lengkapnya interface laptop saya ada sebanyak ini :

samsul@studio:~$ ifconfig
br1       Link encap:Ethernet  HWaddr 52:54:00:77:54:89  
          inet addr:10.10.10.11  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::5054:ff:fe77:5489/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10795 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12706 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1069458 (1.0 MB)  TX bytes:1102266 (1.1 MB)

docker0   Link encap:Ethernet  HWaddr 02:42:ea:80:23:21  
          inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

enp1s0    Link encap:Ethernet  HWaddr 60:eb:69:cf:b4:b1  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:16 

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:65536  Metric:1
          RX packets:270164 errors:0 dropped:0 overruns:0 frame:0
          TX packets:270164 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:2275762887 (2.2 GB)  TX bytes:2275762887 (2.2 GB)

virbr0    Link encap:Ethernet  HWaddr fe:54:00:01:24:82  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7792 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12253 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:469889 (469.8 KB)  TX bytes:16970501 (16.9 MB)

virbr0-nic Link encap:Ethernet  HWaddr 52:54:00:77:54:89  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

vnet0     Link encap:Ethernet  HWaddr fe:54:00:8e:f5:e1  
          inet6 addr: fe80::fc54:ff:fe8e:f5e1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10795 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16848 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1220588 (1.2 MB)  TX bytes:1321366 (1.3 MB)

vnet1     Link encap:Ethernet  HWaddr fe:54:00:01:24:82  
          inet6 addr: fe80::fc54:ff:fe01:2482/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7792 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16394 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:578977 (578.9 KB)  TX bytes:17189549 (17.1 MB)

wlp2s0    Link encap:Ethernet  HWaddr 68:a3:c4:08:5c:12  
          inet addr:192.168.43.218  Bcast:192.168.43.255  Mask:255.255.255.0
          inet6 addr: fe80::6aa3:c4ff:fe08:5c12/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:41044 errors:0 dropped:0 overruns:0 frame:0
          TX packets:29946 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:41996558 (41.9 MB)  TX bytes:3657595 (3.6 MB)

Tabel routing seperti di atas membuat laptop dan mesin virtual saya tidak dapat terkoneksi ke internet.

samsul@studio:~$ ping google.com
PING google.com (172.217.24.110) 56(84) bytes of data.
From 10.10.10.11 icmp_seq=1 Destination Host Unreachable
From 10.10.10.11 icmp_seq=2 Destination Host Unreachable
From 10.10.10.11 icmp_seq=3 Destination Host Unreachable
From 10.10.10.11 icmp_seq=4 Destination Host Unreachable
From 10.10.10.11 icmp_seq=5 Destination Host Unreachable
From 10.10.10.11 icmp_seq=6 Destination Host Unreachable
...............
......
--- google.com ping statistics ---
774 packets transmitted, 0 received, +757 errors, 100% packet loss, time 782548ms
pipe 4

Saya perlu menghapus tabel routing default (10.10.10.1) supaya digantikan ke yang mengarah ke interface wireless saya (192.168.43.1). Maka perintah yang saya jalankan :

  samsul@studio:~$ sudo su
  [sudo] password for samsul:
  root@studio:/home/samsul# cd
  root@studio:~# route del default

Sehingga routing tabel laptop saya berubahh seperti ini :

root@studio:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.43.1    0.0.0.0         UG    600    0        0 wlp2s0
10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 br1
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 virbr0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
192.168.43.0    0.0.0.0         255.255.255.0   U     600    0        0 wlp2s0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

Setelah di tes ping ke internet (dalam hal ini google.com), akhirnya konek juga :

root@studio:~# ping google.com
PING google.com (172.217.27.14) 56(84) bytes of data.
64 bytes from 172.217.27.14: icmp_seq=1 ttl=51 time=15914 ms
64 bytes from 172.217.27.14: icmp_seq=2 ttl=51 time=15146 ms
64 bytes from 172.217.27.14: icmp_seq=3 ttl=51 time=14224 ms
64 bytes from 172.217.27.14: icmp_seq=4 ttl=51 time=13284 ms
64 bytes from 172.217.27.14: icmp_seq=5 ttl=51 time=12377 ms
64 bytes from 172.217.27.14: icmp_seq=6 ttl=51 time=11414 ms
64 bytes from 172.217.27.14: icmp_seq=7 ttl=51 time=10470 ms
64 bytes from 172.217.27.14: icmp_seq=8 ttl=51 time=9472 ms
64 bytes from 172.217.27.14: icmp_seq=9 ttl=51 time=8690 ms
............
.......
^C
--- google.com ping statistics ---
67 packets transmitted, 64 received, 4% packet loss, time 75976ms
rtt min/avg/max/mdev = 63.928/2312.328/15914.020/4439.227 ms, pipe 16

Nah, supaya tabel routing tersebut menjadi permanen, ternyata saya hanya perlu mengubah/menambahkan tanda pagar (baca: tagar, #) di depan opsi gateway pada interface br1 di /etc/network/interfaces :

root@studio:~# vim /etc/network/interfaces

jadinya begini :

iface br1 inet static
   address 10.10.10.11
#   gateway 10.10.10.1
   bridge_ports virbr0-nic enp1s0
   bridge_stp on
   bridge_fd 0.0

Sekian catatan kali ini, kalo gak mudeng ya gak papa. Kalo mau tanya silakan tanya di kolom komentar. Gratis. Kalo saya bisa jawab ya saya jawab. Kalo saya gak bisa jawab ya paling tidak saya bantukan cari di google. 8-) 8-) 8-)

~~DISQUS~~

  • linux/Menghapus.Routing.Table.Utama.di.Linux
  • Terakhir diubah: 5 bulan yang lalu
  • (Perubahan eksternal)