英文:
How to set routes on a linux EC2
问题
如何在Linux中设置以下数值?
我可以设置目的地和网关,但在文档中找不到有关传递genmask、flags、metric、ref、use或Iface标志的任何信息。
有人可以提供要传递的值吗?我已经能够构建以下命令:
```bash
sudo route add -net 0.0.0.0 gw 192.168.96.0 tun0
但我需要添加以下完整命令:
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.96.0 0.0.0.0 UG 0 0 0 eth0
谢谢
<details>
<summary>英文:</summary>
how do I set the below values in linux?
I'm able to set destination and gateway, but I can't find anything in the docs RE passing a flag for genmask, flags, metric, ref, use or Iface.
Can anyone provide the value to pass? I've been able to construct the below
sudo route add -net 0.0.0.0 gw 192.168.96.0 tun0
But I need the full command to add the below;
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.96.0 0.0.0.0 UG 0 0 0 eth0
Thanks
</details>
# 答案1
**得分**: 1
在这种情况下,我建议使用 `ip route` 命令。这是在Linux上管理路由的一种更现代的方式。
例如:
`sudo ip route add default via 192.168.96.0 dev eth0 metric 0`
标志(Flags)、参考数(Ref)和使用数(Use)会自动确定,手动设置它们意义不大。
<details>
<summary>英文:</summary>
In this case, I'd suggest using the `ip route` command. It's a more modern way of managing routes on Linux.
e.g.,:
`sudo ip route add default via 192.168.96.0 dev eth0 metric 0`
Flags, Ref and Use are automatically determined and setting them manually makes little sense.
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论