← 返回命令列表

Linux command

ip-route 命令

网络

复制后可按需替换文件名、目录或参数。

常用示例

Example

ip route

Example

sudo ip route add default via gateway_ip

Example

sudo ip route add default dev eth0

Example

sudo ip route add destination_ip via gateway_ip dev eth0

Delete

sudo ip route delete destination_ip dev eth0

Change

sudo ip route change destination_ip via gateway_ip dev eth0

Get

ip route get destination_ip

Example

ip route list table 100

说明

ip route manages the kernel routing table. It can add, delete, and modify routes, as well as query which route the kernel will use for a specific destination.

参数

list (or no command)
Display the routing table
add
Add a new route
delete
Remove a route
change
Modify an existing route
replace
Change or add if not exists
get _address_
Show route for a specific destination
default
Default gateway route
via _gateway_
Specify next-hop gateway
dev _interface_
Specify output interface
table _id_
Work with a specific routing table

FAQ

What is the ip-route command used for?

ip route manages the kernel routing table. It can add, delete, and modify routes, as well as query which route the kernel will use for a specific destination.

How do I run a basic ip-route example?

Run `ip route` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does list (or no command) do in ip-route?

Display the routing table