我正在尝试在本地网络上设置一台使用永久网关和 DHCP 的机器。我无法设置 IP 静态,但需要添加插入网关的路由。当我尝试“route add”命令时,它告诉我该操作不被允许。尝试在网络适配器的 GUI 框中输入它,但从来没有给我说“OK”的选项
谢谢您的帮助。
我正在添加我尝试过的内容,这应该会让那些一直这样做的人读起来很有趣。但是,我们都是从某个地方开始的 :)
以下是我得到的结果:
XXXXX@S08:~$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
XXXXX@S08:~$ sudo route add 10.0.0.3
SIOCADDRT: No such device
XXXXX@S08:~$ sudo route add -net 0.0.0.0 gw 10.0.0.3
SIOCADDRT: Network is unreachable
XXXXX@S08:~$ sudo route add -net 10.0.0.0 gw 10.0.0.3
SIOCADDRT: Invalid argument
XXXXX@S08:~$ sudo route add -net gw 10.0.0.3
gw: Host name lookup failure
XXXXX@S08:~$ sudo ip route add 10.0.0.3
RTNETLINK answers: No such device
XXXXX@S08:~$ sudo ip route add 10.0.0.3 eth0
Error: either "to" is duplicate, or "eth0" is a garbage.
XXXXX@S08:~$ sudo inet_route add gw 10.0.0.3
sudo: inet_route: command not found
XXXXX@S08:~$ sudo ip route add eth0
Error: an inet prefix is expected rather than "eth0".
XXXXX@S08:~$ sudo ip route add 10.0.0.3
RTNETLINK answers: No such device
XXXXX@S08:~$ sudo ip -d addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
XXXXX@S08:~$ sudo route add default gw 10.0.0.3
SIOCADDRT: Network is unreachable
XXXXX@S08:~$ sudo route add default gw 10.0.0.3 eth0
SIOCADDRT: No such device
XXXXX@S08:~$ sudo ip route add 10.0.0.3 dev eth0
Cannot find device "eth0"
所以你有它 -
答案1
经过不断的搜索和苦恼,我发现板载网卡不受支持。我禁用了它并安装了售后卡,并且能够毫无问题地添加路由。我使用的命令是:
# route add default gw xxx.xxx.xxx.xxx eth0