Make a Network Connection Active


ifup

You actually use the ifup command all the time without realizing it. When you boot your computer to find that you're successfully connected to the Internet, you can thank ifup. If you plug in an Ethernet cable to the port on the back of your Linux box, and a few seconds later you're able to get email again, it's ifup that did the heavy lifting. In essence, ifup runs when it detects a network event, such as a reboot or a cable plugged in, and then executes the instructions found in your network interface configuration files (if you're curious, a note in the preceding section discussed the names and locations of those files).

Sometimes, though, you might experience networking problems and need to run ifup manually. It's incredibly easy to do so: Log on as root, and then follow ifup with the name of the network interface you want to activate.

#  ifconfig lo Link encap:Local Loopback    inet addr:127.0.0.1  Mask:255.0.0.0 ... # ifup eth0 #  ifconfig eth0 Link encap:Ethernet  HWaddr 00:0B:CD:3B:20:E2 inet addr:192.168.0.14  Bcast:192.168.0.255   Mask:255.255.255.0  inet6 addr: fe80::20b:cdff:fe3b:20e2/64 Scope:Link  UP BROADCAST RUNNING MULTICAST  MTU:1500   Metric:1 ... lo   Link encap:Local Loopback  inet addr:127.0.0.1  Mask:255.0.0.0 


Notice that ifup doesn't tell you that it was successful. Indeed, like most Unix apps, ifup is silent upon success, and only noisy if it experiences failure or error. To see what ifup has accomplished, use ifconfig, as shown in the preceding listing.

Note

You can also use ifconfig [interface] up or iwconfig [interface] up to make wired or wireless connections active.




Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net