Linux CLI 101

Written by Ken Gypen

September 6, 2007 | 09:53

Tags: #cli

Networking 101

Linux CLI 101 More fun system toys

Linux is often used as a server OS, with good reason. But it is quite useless to have a server running without a network connection. So in this segment, I'll be pointing out some tools that can be used to configure network interfaces.

The Swiss Army Knife of network interface control is ifconfig. Issuing ifconfig without arguments will list all active interfaces. But “ifconfig” is more then a listing tool. Issue “ifconfig <interface> <IP>” and you redefine the IP adress of the given interface. On top of that, “ifconfig” is also able to change the MTU of an interface, useful for setting up a jumbo frame connection.

When you add in wireless, there's “iwconfig” to set your encryption, keys, SSID, and other useful stuff. Wireless has come an awful long way on Linux, and it's not worth believing all the hype against it - though many specific cards don't have modules, that doesn't mean they're unsupported. Quite the opposite - most cards are supported but by only a few universal drivers, which power the very few chipsets that all of the networking companies use. In Linux, whoever the board partner was is almost immaterial.

Linux CLI 101 More fun system toys Linux CLI 101 More fun system toys

Anyhow, back to networking. To check how secure your networking services are, you can use “netstat”. A succesfull combo is netstat -taunp, which will list all open connections and all listening services (and on what ports/IP they are listening). A rule of thumb - if a service isn't listening, it isn't reachable from the exterior. This is handy to quickly diagnose where a problem is when you can't see your home-built webserver!

To get pretty much any file on the web in true CLI style (you didn't think we'd have to fuss with a graphical browser, did you?!), we have “wget”. The syntax is easy -

wget ftp://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/releases/x86/current/installcd/install-x86-minimal-2007.0-r1.iso

will get the file/webpage (in this case, your minimal CD install for Gentoo) and place it in the current directory. Of course, as with almost all commands, there are a lot of switches that allow you to fine tweak the way “wget” works.

Linux CLI 101 More fun system toysOf course, we also have the most used command in the history of networking - “ping”. A difference to the Windows counterpart is that ping in Linux won't stop until you stop it, through the “<CTRL> + c” keystroke. You can, however, set a finite amount of pings with the '-c #' switch. ping -c 5 localhost will ping your own host 5 times.

Another useful tool is “route”. Its uses are truly enormous (far beyond the scope of this guide), but it's mostly used for setting and checking routing tables. For instance, “route add default gw <gw_IP>” will set your default gateway. You can check it with route -n afterwards.

Last in our way too short list, we have“traceroute”. It shows all the hops a connection to a server undergoes. If you ever wondered how your data gets from the Bit-tech server to your home, issue traceroute bit-tech.net and be amazed.
Discuss this in the forums
YouTube logo
MSI MPG Velox 100R Chassis Review

October 14 2021 | 15:04