Networking & Internet
Checking Your Network Interface
Linux uses ifconfig to view and configure network interfaces. Your
ethernet card will usually appear as eth0, a loopback as
lo.
# ifconfig eth0 Link encap:Ethernet HWaddr 00:0C:29:AB:CD:EF inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1
Ethernet (LAN) Setup
If you have a DHCP server on your network (most home routers do), getting online is simple:
# dhclient eth0 # request an IP via DHCP # ping -c 4 8.8.8.8 # test internet connectivity
For a static IP, edit /etc/network/interfaces (Debian) or
/etc/sysconfig/network-scripts/ifcfg-eth0 (Red Hat).
Dial-Up Internet (PPP)
Dial-up was still common in 2000. Linux uses PPP (Point-to-Point Protocol) to connect via modem. Most distributions include a GUI dialler:
- kppp — KDE's PPP dialler, very user-friendly.
- gnome-ppp — GNOME equivalent.
- wvdial — command-line dialler that auto-detects your modem.
- pppconfig + pon/poff — Debian's approach.
# wvdial & # dial up using wvdial.conf settings # pon provider # Debian: bring up PPP link # poff provider # Debian: drop PPP link
DNS Configuration
DNS servers are configured in /etc/resolv.conf:
nameserver 8.8.8.8
nameserver 8.8.4.4
search localdomain
Host-to-IP overrides can be added in /etc/hosts. The order in
which DNS and local files are consulted is controlled by /etc/nsswitch.conf.
Useful Networking Commands
$ ping hostname # test connectivity $ traceroute hostname # trace route to host $ netstat -rn # show routing table $ nslookup domain.com # query DNS $ route -n # show routing table (alt) # ifconfig eth0 up # bring interface up # ifconfig eth0 down # bring interface down
Internet Tools
Once connected, check out our Internet Tools and Network Connectivity & Security Tools sections for browsers, email clients, IRC, and more.