SYNOPSIS
$ ifconfig [-v] [-a] [-s] [interface]
$ ifconfig [-v] interface [aftype] options | address ...
Display
- If no arguments are given, ifconfig displays the status of the currently active interfaces.
- If a single
interface
argument is given, it displays the status of the given interface only; - if a single
-a
argument is given, it displays the status of all interfaces, even those that are down.
# display all interfaces which are currently available, even if down
$ ifconfig -a
# View network settings of an ethernet adapter:
$ ifconfig eth0
# be more verbose for some error conditions
$ ifconfi -v
Manage Network Interfaces
Disable/Enable Network Interfaces
# change the medium access control (MAC) address of an interface
$ ifconfig [interface_name] down/up
$ ifconfig eth0 up
$ ifconfig eth0 down
Setting
# Assign IP address to eth0 interface:
$ ifconfig eth0 192.168.1.56
# 给eth0网卡配置IP地址,并加上子掩码
$ ifconfig eth0 192.168.1.56 netmask 255.255.255.0
# 给eth0网卡配置IP地址,加上子掩码,加上个广播地址
$ ifconfig eth0 192.168.1.56 netmask 255.255.255.0 broadcast 192.168.1.255
# 配置和删除IPv6地址
# 为网卡eth0配置IPv6地址
$ ifconfig eth0 add 33ffe:3240:800:1005::2/64
# 为网卡eth0删除IPv6地址
$ ifconfig eth0 add 33ffe:3240:800:1005::2/64
# Set mac
$ ifconfig wlan0 hw ether 13:11:20:33:49:66
# 启用和关闭ARP协议
# 开启
$ ifconfig eth0 arp
# 关闭
$ ifconfig eth0 -arp
Reference
- https://en.wikipedia.org/wiki/Ifconfig
- https://man7.org/linux/man-pages/man8/ifconfig.8.html
- https://www.runoob.com/linux/linux-comm-ifconfig.html
FEATURED TAGS
algorithm
algorithmproblem
architecturalpattern
architecture
aws
c#
cachesystem
codis
compile
concurrentcontrol
database
dataformat
datastructure
debug
design
designpattern
distributedsystem
django
docker
domain
engineering
freebsd
git
golang
grafana
hackintosh
hadoop
hardware
hexo
http
hugo
ios
iot
java
javaee
javascript
kafka
kubernetes
linux
linuxcommand
linuxio
lock
macos
markdown
microservices
mysql
nas
network
networkprogramming
nginx
node.js
npm
oop
openwrt
operatingsystem
padavan
performance
programming
prometheus
protobuf
python
redis
router
security
shell
software testing
spring
sql
systemdesign
truenas
ubuntu
vmware
vpn
windows
wmware
wordpress
xml
zookeeper