질문: 기본 경로를 구성하는 방법은 무엇입니까? [폐쇄]

질문: 기본 경로를 구성하는 방법은 무엇입니까? [폐쇄]

질문이 있습니다. 기본 경로를 구성하려면 어떤 명령을 사용하시겠습니까? 내 말은, 나는 다음을 시도했습니다. 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

그런 다음 기본 게이트웨이를 구성해 보십시오.

ip route add default via eth3 peer gw 10.0.3.142 dev eth0

그러나 그것은 소용이 없습니다. :(

내 네트워크 구성은 다음과 같습니다.

[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

답변1

이를 시스템 기본 경로로 만들려면 다음을 수행하십시오.

ip route add default via 10.0.3.1

하지만, 이미 다른 기본 게이트웨이가 있는 경우 다음을 수행하세요.

ip route replace default via 10.0.3.1

그것을 교체합니다.

관련 정보