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
In this tutorial:
- Linux Commands
- Command Shell Basics
- Editing commands
- Wildcards
- Redirection and piping
- Environment variables
- Shell scripts
- Directory and File Handling Commands
- The cd command
- The mkdir command
- The rmdir command
- The ls command
- The cp command
- The rm command
- The mv command
- The touch command
- The cat command
- Commands for Working with Packages and Services
- The rpm command
- Commands for Administering Users
- The usermod command
- The chage command
- The passwd command
- The newusers command
- The groupadd command
- The groupdel command
- Commands for Managing Ownership and Permissions
- The chgrp command
- The chmod command
- Networking Commands
- The ipconfig command
- The netstat command
- The ping command
- The route command
- The traceroute command