tldr/pages.zh/osx/route.md

29 lines
566 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# route
> 手动操作路由表.
> 需要root权限.
- 通过网关向目标添加路由:
`sudo route add {{路由ip地址}} {{网关地址}}`
- 通过网关向 子网 / 24 添加路由:
`sudo route add {{子网ip}}/24 {{网关地址}}`
- 在测试模式下运行(不做任何操作,只打印):
`sudo route -t add {{路由ip地址}}/24 {{网关地址}}`
- 删除所有路由:
`sudo route flush`
- 删除特定路由:
`sudo route delete {{路由ip地址}}/24`
- 查找并显示目标的路由主机名或IP地址:
`sudo route get {{目标}}`