Difference between revisions of "Ifconfig"

From wikieduonline
Jump to navigation Jump to search
Line 9: Line 9:
 
=== Linux alias ===
 
=== Linux alias ===
 
  ifconfig [[eth]]0''':0''' 192.168.1.6 up
 
  ifconfig [[eth]]0''':0''' 192.168.1.6 up
 +
 +
 +
ifconfig eth3:0
 +
eth3:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
 +
        inet 192.168.1.6  netmask 255.255.255.0  broadcast 192.168.1.255
 +
        ether 33:54:00:7d:35:22  txqueuelen 1000  (Ethernet)
  
 
=== [[macOS]] [[alias]] ===
 
=== [[macOS]] [[alias]] ===

Revision as of 09:09, 16 February 2021

ifconfigis a command in Unix-like operating systems like Linux[1], FreeBSD, OpenBSD, macOS for Ethernet network interface configuration.


In macOS, the ifconfig command functions as a wrapper to the IPConfiguration agent, and can control the BootP and DHCP clients from the command-line. Use of ifconfig to modify network settings in Mac OS X is discouraged, because ifconfig operates below the level of the system frameworks which help manage network configuration. To change network settings in Mac OS X from the command line, use /usr/sbin/ipconfig or /usr/sbin/networksetup.

ifconfig command is included in the net-tools package but not installed by default in RHEL since version 7[2].

Configuring an alias IP

Linux alias

ifconfig eth0:0 192.168.1.6 up


ifconfig eth3:0
eth3:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.6  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 33:54:00:7d:35:22  txqueuelen 1000  (Ethernet)

macOS alias

Configure 3 alias in en1 interface, https://ss64.com/osx/ifconfig.html:

sudo ifconfig en1 inet 192.168.10.2/24 add
sudo ifconfig en1 inet 192.168.20.2/24 add
sudo ifconfig en1 inet 192.168.30.2/24 add

or

sudo ifconfig en1 inet 192.168.10.2/24 alias
sudo ifconfig en1 inet 192.168.20.2/24 alias
sudo ifconfig en1 inet 192.168.30.2/24 alias


Remove/delete alias:

sudo ifconfig en1 inet 192.168.10.2/24 delete


ifconfig eth# up or ip link set eth0 up

Activities

  • Change your MAC address: ifconfig {eth0|wlan0} hw ether CA:CA:CA:CA:CA:CA

Related terms

See also

References

Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.

Source: https://en.wikiversity.org/wiki/Ifconfig

Advertising: