ifconfig usage

来源:互联网 发布:花千骨网络播放量 编辑:程序博客网 时间:2024/05/17 22:07

Image:Vm-power-on-medium.png Usage Syntax

ifconfig interface [options] | (ip-address [netmask mask] | mac-address)

Common options include;

  • up | down - enable or disable the interface
  • metric - specify the interface metric (used by routing and other protocols)
  • mtu - specify the interface MTU in bytes
  • [-]arp - enable or disable ARP on the interface (enabled by default)
  • [-]promisc - enable or disable promiscuous mode on the interface (disabled by default)
  • hw ether mac-address - specify the interface MAC address

Image:Vm-power-on-medium.png Usage Examples

ifconfig - display current interface configuration and status

ifconfig eth0 1.1.1.1 netmask 255.255.255.0 - configure interface eth0 with an IP address of 1.1.1.1 and subnet mask of 255.255.255.0

ifconfig eth0:0 2.2.2.1 netmask 255.255.255.0 - configure interface eth0 with an IP alias (or secondary) of eth0:0 using an IP address of 2.2.2.1 and subnet mask of 255.255.255.0 (use eth0:1 onwards for more)

ifconfig eth0 -arp - disable ARP on interface eth0

ifconfig eth0 mtu 1400 - configure interface eth0 with an MTU of 1400 bytes

ifconfig  eth0 inet 192.168.1.1 up

 

 

注:

 

ifconfig 单独使用 只显示active的接口

ifconfig -a 显示所有接口

 

 

原创粉丝点击