|
6. Configuring The Network
The configuration file
After you have installed knoppix to your hard disk, the network autodetection
has been disabled. This is because we chose to install a debian style
system. So, now we will need to do the configuration manually.
The configuration file that is controlling how the network is handled is
/etc/network/interfaces, so we are going to edit this file.
This is how the file should look like in our setup of the box with two
network cards.
Code listing 6.1: /etc/network/interfaces file |
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
# automatically added when upgrading
auto lo eth0 eth1
iface lo inet loopback
iface eth1 inet static
address 192.168.1.1
netmask 255.255.255.0
iface eth0 inet dhcp
|
This file is saying we have automatically configured interfaces for
loopback (lo), eth0 and eth1 interfaces. loopback is a virtual network
interface, used by some programs to connect to the local computer.
Hence it's name. eth0 and eth1 are the real network interfaces
in your computer. eth1 is the one we will assume is connected to your local
network and eth0 is the one that will be connected to the internet. This
choice is rather arbitrary and could be vice versa, but we will for the
rest of this document assume you have configured everything like this.
The interface eth1 is configured as a static network interface, which means
it will never change it's ip address. You are allowed to choose an ip
address here, since it will not be used anywhere else but on your local
network, but for safety reasons it is best if you use an address in one
of the reserved ranges, which are listed below.
| network |
network mask |
description |
| 10.0.0.0 |
10.255.255.255 |
Any address 10.x.x.x |
| 172.16.0.0 |
172.31.255.255 |
Any address 172.16.x.x to 172.31.x.x |
| 192.168.0.0 |
192.168.255.255 |
Any address like 192.168.x.x |
The interface eth0 is configured as a dhcp client interface, which may
not be appropriate for your configuration, since it is dependent of the
upstream Internet Service Provider, and mine delivers dhcp addresses.
Other options usually are dialup kinds and network configuration there
is different. However, sometimes you can buy routers that dial up for
you and provide you a dhcp address anyway, so in case you have one like
this, this configuration may be still valid in your situation. If not,
you are at the moment, on your own. Sorry, but I have to limit the
scope for now ;-)
Verifying the network interface configuration
Afterwards, we can test the configuration by typing the following set
of commands:
Code listing 6.2: Bringing up the interfaces |
kristof@knoppixbox:~/$ ifup eth0
kristof@knoppixbox:~/$ ifup eth1
kristof@knoppixbox:~/$ ifconfig
eth0 Link encap:Ethernet HWaddr 52:54:05:C3:FF:0E
inet addr:10.0.1.3 Bcast:255.255.255.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:40495 errors:0 dropped:107 overruns:0 frame:12
TX packets:30324 errors:0 dropped:0 overruns:0 carrier:0
collisions:1338 txqueuelen:100
RX bytes:21385539 (20.3 MiB) TX bytes:4947621 (4.7 MiB)
Interrupt:12 Base address:0xc000
eth1 Link encap:Ethernet HWaddr 00:D0:09:5F:7E:83
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13509602 errors:301 dropped:16108 overruns:261 frame:0
TX packets:12756299 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:783185984 (746.9 MiB) TX bytes:3534492144 (3.2 GiB)
Interrupt:11 Base address:0x5000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2171 errors:0 dropped:0 overruns:0 frame:0
TX packets:2171 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:12300096 (11.7 MiB) TX bytes:12300096 (11.7 MiB)
|
This could be enough to get you going if your ISP gives you a name
server via dhcp, but some don't. Then you need to additionally add
your nameserver into the nameserver configuration file,
/etc/resolv.conf, so that it
contains the single line nameserver 195.130.132.17 or whatever
ip address your ISP provides you with. The command to do this is
sudo nedit /etc/resolv.conf. There will be more details about
this in the dns section, but you need
to get your network going at this stage in order to install some
of the tools we'll need in the following sections.
Proxy Servers
Some providers want all traffic to go through their proxy servers,
in order to provide some "content caching". Of course, in the
mean time it is easier for them to watch what you are doing, but
anyway.
When you need to set a proxy server, you have to influence the
environment variable that most tools look at. What you need
to do is execute the following command.
Code listing 6.3: Setting a proxy server |
kristof@knoppixbox:~/$ export set http_proxy="http://proxy.servers.com:8080/"
kristof@knoppixbox:~/$ echo $http_proxy
http://proxy.pandora.be:8080/
|
Of course, setting this all the time becomes a nuisance in no time,
so we should be able to set it in one place. What you can do is
add this command to the end of the file /etc/profile
and you should get the same effect without every time issuing
the command.
Troubleshooting
Again, I hate to admit it, but sometimes things
go wrong. Generally, it is not a problem
to fix it. What you need to figure out is the source of the problem
and this requires a little networking knowledge. However, some things
are easy verifiable, and a small checklist is provided here:
- Check if all network interfaces are up, using ifconfig.
If they are up, you can start pinging. In case you got an
ip address via a DHCP server, you can be happy with that
part already, you got an IP address and the connection to your
upstream provider is probably ok.
- Can you connect to your upstream provider? You can first start
pinging IP addresses of server like your name server. If this
ping is ok, you can assume the network is ok. Is your nameserver
filled in in /etc/resolv.conf, like it should be?
Then you can try and ping your nameserver, or any other address
that responds to ping (most websites addresses do), to check
if the name resolution works.
Code listing 4: successful ping to name server |
kristof@knoppixbox:~# cat /etc/resolv.conf
nameserver 195.130.130.130
nameserver 195.130.131.2
search pandora.be
kristof@knoppixbox:~# ping -c 5 195.130.131.2
PING 195.130.131.2 (195.130.131.2): 56 data bytes
64 bytes from 195.130.131.2: icmp_seq=0 ttl=60 time=13.3 ms
64 bytes from 195.130.131.2: icmp_seq=1 ttl=60 time=18.4 ms
64 bytes from 195.130.131.2: icmp_seq=2 ttl=60 time=18.3 ms
64 bytes from 195.130.131.2: icmp_seq=3 ttl=60 time=17.3 ms
64 bytes from 195.130.131.2: icmp_seq=4 ttl=60 time=15.4 ms
--- 195.130.131.2 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 13.3/16.5/18.4 ms
kristof@knoppixbox:~#
|
- If you got this far, you should be able to surf the internet. Take Konquerer for
a spin and check it out. While you're at it, maybe something new is on on slashdot?
If you can't get there, don't forget some providers have a proxy server to be
configured in the browser, and not all browsers pick up the environment variable.
|