Linux command
ip-address 命令
网络
复制后可按需替换文件名、目录或参数。
常用示例
List
ip address show
Example
ip address show up
Example
ip address show dev [eth0]
Example
ip -4 address show
Add
sudo ip address add [192.168.1.100/24] dev [eth0]
Delete
sudo ip address delete [192.168.1.100/24] dev [eth0]
Flush
sudo ip address flush dev [eth0]
说明
ip address manages IP addresses on network interfaces. It can display, add, delete, and flush addresses for both IPv4 and IPv6 protocols.
参数
- show dev _device_
- Display IP addresses (default action).
- add _address/prefix_ dev _device_
- Add an IP address to an interface.
- change _address/prefix_ dev _device_
- Change properties of an existing address.
- replace _address/prefix_ dev _device_
- Add or update an address on an interface.
- delete _address/prefix_ dev _device_
- Remove an IP address from an interface.
- flush dev _device_
- Remove all addresses matching criteria.
- save
- Save address configuration to stdout.
- restore
- Restore address configuration from stdin.
- dev _device_
- Interface name to operate on.
- scope _global|link|host_
- Filter or set address scope.
- label _label_
- Set address label (must start with device name).
- broadcast _address_
- Set broadcast address.
- metric _number_
- Set priority of the prefix route for the address.
- valid_lft _lft_
- Valid lifetime of the address (default: forever).
- preferred_lft _lft_
- Preferred lifetime of the address (default: forever).
- up
- Filter to show only active (UP) interfaces.
- permanent
- Filter to show only permanent (static) addresses.
- dynamic
- Filter to show only dynamically assigned addresses.
- to _prefix_
- Filter addresses matching a prefix.
FAQ
What is the ip-address command used for?
ip address manages IP addresses on network interfaces. It can display, add, delete, and flush addresses for both IPv4 and IPv6 protocols.
How do I run a basic ip-address example?
Run `ip address show` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does show dev _device_ do in ip-address?
Display IP addresses (default action).