Help with Linux Networking
This page is intended to be a consolidated resource of all things
pertaining to networking your Linux laptop. It is assumed that you have
an IBM Thinkpad T43 with Suse 10 Linux (running KDE), as imaged by
Brad Tufts and
Tim Riker.
How it works
Your laptop's OS is set up to use the following network interfaces:
network interface name |
module name |
description |
eth0 |
tg3 |
land-line network interface |
wlan0 |
ipw2200 |
wireless network interface |
lo |
n/a |
Loopback interface (ignore it) |
tun0 |
n/a |
tunnel through VPN, appears when your VPN is active (via KVpnc) |
vpntun0 |
n/a |
tunned through VPN, appears when your VPN is active (via vpnc) |
modem0 |
usbserial |
Sprint air-card connection (normally /dev/ttyUSB0) |
Every linux distribution does the following items differently. Even
in suse 10, this is not uniform. The following is how we are set up:
On boot, in the kernel load, suse can be set up to load modules in a fixed order (to set this, edit, as root, /etc/sysconfig/kernel and edit this line MODULES_LOADED_ON_BOOT="tg3 nvram"). This is recommended.
At any rate, the modules for the network interfaces are loaded into
the OS. While executing the bootup scripts, suse looks at all files
matching /etc/sysconfig/network/ifcfg-*. Each of these files
relates to a network interface. This is what connects the module to the
specific network interface. In these files, the line STARTMODE
determines how the interfaces are started. If they are all set to manual, then nothing will automatically be launched on boot (it may be a good idea to start at this point).
Comands and Tools
Command line
command |
example |
description |
ifconfig |
ifconfig -a |
Use this command to see the interfaces that are set up. The -a option also shows ones that aren't up. |
ifup |
sudo ifup eth0 |
Use this to bring that network interface up. |
ifdown |
sudo ifdown wlan0 |
Use this to bring down an interface. |
iwconfig |
iwconfig |
Shows the wireless interfaces. |
vpnc |
sudo vpnc onlyDevNet2.conf |
Starts up the VPN (assuming onlyDevNet2.conf is configured; see below). |
vpnc-disconnect |
sudo vpnc-disconnect |
Disconnects from the VPN. |
GUI
program |
What it's for (in context of networking) |
How to use it |
kinternet |
This allows you to manage your network connections easily. |
When running, it appears as a plug (with
prongs facing northeast) icon in the lower right corner of your
desktop. You can right-click on it, choose interface and select which interface to control. Then dial in or hang up. There is also some configuration you can do here. A left-click is configured by default to toggle connection on and off. |
kwifimanager |
Manages wireless network connections |
Appears as a series of vertical green bars in
the lower-right corner of your desktop. Left clicking brings up the app
interface. You can use this to configure your wireless connections,
find networks, etc. |
KVpnc |
Connects you to the VPN, so you can get to the machines on the church's network, as well as out to the internet. |
Run this program when at home, or at work on the wireless, once the interface is connected to the network. Click the connect button and wait about a minute, and it will let you know it's working. |
Connecting at work
Land-line
Down your wireless interface, if it's not already (ifconfig and look for an entry for wlan0). If it's up, disconnect the VPN, then down it with sudo ifdown wlan0.
Assuming you have your network interfaces available, but down, make sure you are plugged into the network, open a shell and run
Use the command ifconfig to check the status. Check its output to see what IP address your laptop was assigned for interface eth0.
Alternately, run kinternet, right-click to make sure that the eth0 interface is selected, then choose dial in.
Wireless
Down your land-line interface, if it's not already (ifconfig and look for an entry for eth0). If it's up, down it with sudo ifdown eth0.
Assuming you have your network interfaces available, but down, run
Use the command ifconfig to check the status. Check its
output to see what IP address your laptop was assigned for interface
wlan0. It might take a few moments, so if the IP doesn't show up
immedaitely, wait ten seconds and try again.
Alternately, run kinternet, right-click to make sure that the wlan0 interface is selected, then choose dial in.
Once you have an IP address, you need to connect to the VPN (described below).
Connecting at home
Land-line
Follow the same instructions for connecting to a home network as for
the office network, assuming you have something serving DHCP to give
you an IP address. Until you connect to the VPN, you will need to set
your browser's proxy to "direct connect", as you can't see the proxy
servers at work.
Once you have an IP address, you need to connect to the VPN (described below).
Wireless
The file /etc/sysconfig/network/ifcfg-wlanxxxxxxx contains
settings for the wireless connection here in the office. You will
likely need a different configuration for home use. Probably the best
way to accomplish this is to move that file out of the way (rename it
to something that doesn't start with ifcfg so that the system won't find it), and use YaST2 to create another one (K-Menu then control center then YaST2 Modules then Network Devices then Network Card (enter Administrator Mode
using the button at the bottom), then configure your wireless card to
connect to your home wireless network. Once you're done, you can move
that generated file out of the way, and replace it with the work one,
for connecting at work.
I wrote a one-line script that copies the appropriate file onto the
one that the system is looking for, so I can easily switch between work
and home wireless networks.
Once you have an IP address, you need to connect to the VPN (described below).
Sprint air-card
To set this up the first time only, do the following:
- Plug the air-card into the lower PCMCIA slot.
- add this line to /etc/init.d/boot.local: modprobe usbserial vendor=0x1410 product=0x1110
- Using yast, configure the modem, as follows
- Network devices | modem
- Add a new modem
- modem device: /dev/ttyUSB0
- custom provider
- provider name: Sprint
- phone number: #777
- user name: "user"
- password: "password"
- uncheck box "always ask for password"
- next
- finish
- edit /etc/sysconfig/network/ifcfg-modem0 and add PPPD_OPTIONS='lcp-echo-interval 0'
- reboot (or better yet just run rmmod usbserial then /etc/init.d/boot.local)
Once it has been configured, do the following to bring it up (check ifconfig
until you get an IP address, it can take a little while, and the modem0
interface won't show up at first; just be patient and try it every few
seconds):
Of course, once you connect to the internet using the air card, you still need to connect to the VPN, as described below.
And this will bring it down:
For reference, here is the block of configuration code from /proc/bus/usb/devices that is being used:
Sprint Air-Card Alternate Configuration
For some users, the above instructions don't work outside the valley. Alternately, you may need to do the following:
- complete "first time only" steps as above
- download and install kppp from suse
- set the following in kppp settings: lcp-echo-failure 9999
- run kppp, connect from gui and then run vpn
VPN Connection
KNOWN ISSUE Some people have reported a problem with accessing the web via the VPN from home. See Linux Image Issues, the section on VPN.
There are two ways to connect to the VPN, one using the GUI program KVpnc, the other using a command line program, vpnc.
KVpnc
The GUI method is always very slow to connect, and sometimes doesn't work. Run the KVpnc program and connect to the VPN. This step can take more than 60 seconds, after you click the connect button, until it reports you are connected.
vpnc
You need to edit (as root) the file /etc/vpnc/onlyDevNet2.conf. Comment out the NO DISCONNECT line, and uncomment out the lines for username and password. Put in your groupwise username and password here.
To connect, use this command:
To disconnect, use this command:
Settings
For reference, here are the settings needed to connect to the office VPN:
ESSID (called Network name in the kwifimanager tool): chq-v601
Operation mode: managed
speed: auto
Using encryption. Key: 01234567890123456789012345 (as hex)
Safety when using SSH
If you regularly ssh into other boxen, be careful with your use of commands like sudo ifdown eth0.
Accidentally typing this into a console that is attached to another box
can have disastrous consequences. After doing this once, I wrote a set
of scripts to use on my laptop, eliminating the risk. I put the
following files, with the following contents, into my bin directory
(yours should be on your path), and did chmod +x XXXX for each file.
script name |
purpose |
content |
lanup |
Connect to a landline ethernet network |
sudo ifup eth0 |
landown |
Disconnect from a landline ethernet network |
sudo ifdown eth0 |
wirelesswork |
Prepare to connect to wireless at work |
sudo cp /etc/sysconfig/network/work /etc/sysconfig/network/ifcfg-wlan-bus-pci-0000:04:02.0 |
wirelesshome |
Prepare to connect to wireless at home |
sudo cp /etc/sysconfig/network/home /etc/sysconfig/network/ifcfg-wlan-bus-pci-0000:04:02.0 |
wirelessup |
Connect to a wireless network (use ifconfig until an IP address is assigned) |
sudo ifup wlan0 |
wirelessdown |
Disconnect from a wireless network |
sudo ifdown wlan0 |
vpnup |
Connect to VPN (see elsewhere in this document for how to set this up) |
sudo vpnc onlyDevNet2.conf |
vpndown |
Disconnect from VPN |
sudo vpnc-disconnect |
airup |
Activate the air card |
sudo ifup modem0 |
airdown |
Disconect from the air card network |
sudo ifdown modem0 |
Extreme measures
Other things to try, if things aren't going well.
- rmmod tg3 will remove the module from the OS, and modprobe tg3 will put it back. Use with caution, when you have an interface that just won't go down.
Glad it's useful! I'm not sure about the blank window. Doesn't sound right to me. To be honest, I'm having success just using sudo ifup eth0 sort of command-line commands.