Appendix C. IP Address Management

Table of Contents

C.1. ifconfig
C.1.1. Displaying interface information with ifconfig
C.1.2. Bringing down an interface with ifconfig
C.1.3. Bringing up an interface with ifconfig
C.1.4. Reading ifconfig output
C.1.5. Changing MTU with ifconfig
C.1.6. Changing device flags with ifconfig
C.1.7. General remarks about ifconfig
C.2. ip address
C.2.1. Displaying interface information with ip address show
C.2.2. Using ip address add to configure IP address information
C.2.3. Using ip address del to remove IP addresses from an interface
C.2.4. Removing all IP address information from an interface with ip address flush
C.2.5. Conclusion

A machine which can access Internet resources has an IP address, whether that IP address is a public address or a private address hidden behind an SNAT router [44]. With the increasingly common use of linux machines as servers, desktops, and embedded devices and with changing network topologies and re-addressing, the need to be able to determine the current IP address of a machine and modify that address has consequently become a common need.

I assume in this chapter that the reader has some familiarity with CIDR addressing and netmasks. If any of these concepts are unfamiliar, or the reader would like to brush up, I suggest a visit to some of the links which can be found in Section I.1.3, “General IP Networking Resources”.

We'll begin our tour of the utilities for observing, changing, removing, and adding IP addresses to network devices with ifconfig, the traditional utility for IP management. We will also examine the newer and more flexible ip address, a key part of the iproute2 package.



[44] I'm sure somebody will be glad to nitpick here and tell me that s/he has a machine connected to the Internet which uses SNA, DecNET, IPX, or NetBEUI to connect to another host which actually does speak IP, thus proving that not every host which has access to the Internet is actually directly speaking IP. Another example is doubtless, wireless devices, such as telephones. Here, I'll concern myself with the majority case.