
我目前使用 GNU/Linux 有以下路由表:
default via 192.168.1.1 dev eno1 proto static metric 100
10.0.0.0/8 dev enp1s0 scope link linkdown
169.254.0.0/16 dev virbr0 scope link metric 1000 linkdown
192.168.1.0/24 dev eno1 proto kernel scope link src 192.168.1.2 metric 100
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown
我使用帶有 eno1 的 NIC 透過子網路上的網關連接到互聯網192.168.1.0/24
10.0.0.1
我使用帶有 enp1s0 的 NIC 作為我的內部子網路( ) 的 NAT 網關( 10.0.0.0/8
) 現在我想10.0.0.0/8
透過我的外部 (eno1) 介面新增(學習目的)到子網路的路由:
# Added route via eno1, resulting in routing table shown above
ip route add 10.0.0.0/8 dev enp1s0
# When I add route via enp1s0, command causes error
ip route add 10.0.0.0/8 dev eno1
RTNETLINK answers: File exists
你能告訴我如何解決這個問題嗎?謝謝。