Networking

ifconfig

ifconfig lo0 localhost up

ifconfig interface ip-address netmask mask

The first form configures the loopback interface. The second form assigns the specified IPv4 address and subnet mask to interface. FreeBSD and Solaris allow you to replace the address and netmask parameters (including the keywords) with a CIDR address.

Displaying information about network interfaces

ifconfig [options] [interface]

Display the configuration of the specified interface(s).

-a

Display data for all interfaces (not supported by HP-UX).

-l

(FreeBSD and AIX)

List all network interfaces.

Network interface configuration files

AIX:

Stored in the ODM; modify with mktcpip or SMIT.

FreeBSD:

/etc/rc.conf:

hostname=″name″ifconfig_iface=″ip-addr netmask mask

HP-UX:

/etc/rc.config.d/netconf:

HOSTNAME=″name″INTERFACE_NAME[n]=nameIP_ADDRESS[n]=addrSUBNET_MASK[n]=maskINTERFACE_STATE[n]=up|down

n is the interface number (starting at 0).

Linux:

/etc/sysconfig/networking/devices/ifcfg-ethnRed Hat

/etc/sysconfig/network/ifcfg-ethn

DEVICE=name                 Red HatBOOTPROTO=static|dhcpIPADDR=addrNETMASK=maskONBOOT=yes|no               Red Hat onlySTARTMODE=yes|no            SuSE only

SuSE

/etc/sysconfig/network:

HOSTNAME=″name

Red Hat

/etc/HOSTNAME:

Holds the hostname (SuSE).

Solaris:

/etc/hostname.iface:

The first line holds the hostname. Any additional line(s) hold ifconfig command arguments (optional).

Displaying the system’s MAC address

Get Essential System Administration Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.