Networking / Beginners

The ipconfig command

ipconfig displays and sets configuration options for network interfaces. Although you can configure an Ethernet adapter using this command, you'll rarely have to. Linux does a pretty good job of automatically configuring network adapters, and the GNOME-based Network Configuration tool supplied with the Red Hat distribution should be able to handle most network configuration chores. So you'll use ipconfig mostly to display network configuration settings.

The basic syntax for ipconfig is

ipconfig interface [address] [netmask mask]
[broadcast broadcast]

The following paragraphs describe the options that you can use on the ipconfig command:

  • Interface: The symbolic name for your network adapter. It's typically eth0 for the first Ethernet adapter or eth1 for the second adapter.
  • Address: The IP address you want to assign to the interface, such as 192.168.1.100.
  • netmask: The subnet mask to use, such as 255.255.255.0.
  • broadcast: The broadcast, which should be the highest address on the subnet. For example: 192.168.1.255.

If you enter ipconfig without any parameters, the ipconfig command displays the current status of your network adapters, like this:

eth0 	Link encap:Ethernet HWaddr 00:20:78:16:E0:6A
	UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
	RX packets:0 errors:0 dropped:0 overruns:0 frame:0
	TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
	collisions:0 txqueuelen:100
	RX bytes:0 (0.0 b) TX bytes:2916 (2.8 Kb)
	Interrupt:11 Base address:0xd000
eth1 	Link encap:Ethernet HWaddr 00:40:05:80:51:F3
	inet addr:192.168.3.100 Bcast:192.168.3.255 Mask:255.255.255.0
	UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
	RX packets:2358 errors:0 dropped:0 overruns:0 frame:0
	TX packets:1921 errors:0 dropped:0 overruns:0 carrier:0
	collisions:0 txqueuelen:100
	RX bytes:265194 (258.9 Kb) TX bytes:424467 (414.5 Kb)
	Interrupt:3 Base address:0xc000
lo 	Link encap:Local Loopback
	inet addr:127.0.0.1 Mask:255.0.0.0
	UP LOOPBACK RUNNING MTU:16436 Metric:1
	RX packets:93707 errors:0 dropped:0 overruns:0 frame:0
	TX packets:93707 errors:0 dropped:0 overruns:0 carrier:0
	collisions:0 txqueuelen:0
	RX bytes:6393713 (6.0 Mb) TX bytes:6393713 (6.0 Mb)

To change the IP address of an adapter, use ipconfig like this:

$ ipconfig eth0 192.168.1.200
[Previous] [Contents] [Next]