Para tornar isso a rota padrão do sistema, faça o seguinte:
ip route add default via 10.0.3.1
Mas , se você já tiver outro gateway padrão, faça o seguinte:
ip route replace default via 10.0.3.1
Para substituí-lo.
Eu tenho uma pergunta que comando você usaria para configurar a rota padrão? Quero dizer, eu tentei:
ping 192.168.3.50
PING 192.168.3.50 (192.168.3.50) 56(84) bytes of data.
64 bytes from 192.168.3.50: icmp_seq=1 ttl=64 time=0.058 ms
64 bytes from 192.168.3.50: icmp_seq=2 ttl=64 time=0.030 ms
64 bytes from 192.168.3.50: icmp_seq=3 ttl=64 time=0.030 ms
Em seguida, tentou configurar o gateway padrão:
ip route add default via eth3 peer gw 10.0.3.142 dev eth0
mas não funcionou. : (
Aqui está minha configuração de rede:
[root@host-0-0 /]# ifconfig -a
ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.3.137 netmask 255.255.255.248 broadcast 10.0.3.143
inet6 fe80::19f6:e3d9:7122:9ccb prefixlen 64 scopeid 0x20<link>
ether 00:0c:89:00:03:90 txqueuelen 1000 (Ethernet)
RX packets 1069 bytes 121480 (118.6 KiB)
RX errors 25 dropped 0 overruns 0 frame 25
TX packets 869 bytes 123920 (121.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.254 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::8d3:43ff:fe9c:e9c2 prefixlen 64 scopeid 0x20<link>
ether 0a:d3:43:9c:e9:c2 txqueuelen 1000 (Ethernet)
RX packets 13 bytes 1026 (1.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 24 bytes 3797 (3.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.3.62 netmask 255.255.255.240 broadcast 192.168.3.63
inet6 fe80::af:97ff:fed7:9170 prefixlen 64 scopeid 0x20<link>
ether 02:af:97:d7:91:70 txqueuelen 1000 (Ethernet)
RX packets 20 bytes 1600 (1.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32 bytes 4419 (4.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 6 bytes 480 (480.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6 bytes 480 (480.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:fb:c1:2c txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0-nic: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 52:54:00:fb:c1:2c txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Para tornar isso a rota padrão do sistema, faça o seguinte:
ip route add default via 10.0.3.1
Mas , se você já tiver outro gateway padrão, faça o seguinte:
ip route replace default via 10.0.3.1
Para substituí-lo.
Tags networking linux