Anda di halaman 1dari 21

Background

I installed Debian on my spare laptop today using debian-6.0.4-i386-netinst.iso, and because I


really wanted a minimal install (and because I didnt like how it would take so long downloading
updated packages when installing the base system), I finished the installation without
configuring any networking. This is all fine as far as minimal installation goes, but then now, I
dont have all that nice software that handles the networking stuff for me.
This tutorial is for those people who just want to know the commands to get this done. Im also
going to presume everything is done as root, just to make things easier (also, in my fresh install,
sudo wasnt installed). Ive also repeated the installation on virtualbox so that I can save
screenshots.

Firmware
This can actually be handled during the installation process. While you were installing Debian, it
might have asked you to load some firmware. This firmware may or may not be required. For
instance, if you need ipw2200, consult http://wiki.debian.org/ipw2200. For Debian firmware
stuff in general, consult section 6.4 of the installation guide.
To check whether this is a problem, run iwconfig and if your wireless component is listed
properly, then firmware probably isnt a problem.

Ethernet Connection
dhclient "your network interface"

where your network interface is your ethernet device (most likely eth0). So if youre interested
in the connection on eth0, you would type:
dhclient eth0

Its that simple.


When you run dhclient the first time, you might see:
chown: failed to get attributes of `/etc/resolv.conf': No such file or
directory
chmod: failed to get attributes of `/etc/resolv.conf': No such file or
directory

Dont panic. Chances are everything worked out fine. To check that youre connected to the
internet, try:
ping -c 3 http://www.google.com

You should get something like

If you get a message telling that the host could not be found (i.e. ping: unknown host
http://www.google.com), you are NOT connected to the internet. You might want to double
check ifconfig -a to see if your interface is recognized. If not, it could be a firmware problem.

Configuring apt-get (i.e. editing sources.list)

Great! Now you have an internet connection. So how come I cant `apt-get install stuff?

Well you can, but it wont download anything. This is because you havent configured the mirror
from which to download packages.
Try nano /etc/apt/sources.list.
You might get something like this:

To get the Debian packages you love, at the bottom of the document add:

deb http://http.us.debian.org/debian squeeze main contrib non-free


deb http://security.debian.org/ squeeze/updates main contrib non-free

Of course, you should replace squeeze with whatever version you are using.
So that you end up with something like this:

Once you save and exit, run apt-get update to let apt know that youve updated the
sources.list file. It might complain to you that you have duplicate sources (security.debian.org/
squeeze/updates main was repeated) if you did it exactly the way I did it, but Im pretty sure its
mostly harmless.

Now you can just apt-get install stuff!!

Automatic connection on startup


As magical as our tutorial has been so far, you will notice that when you reboot, you need to
manually call dhclient. How do you get it to do it automatically?
Just add a couple lines to /etc/network/interfaces (replace eth0 with your network interface)
auto eth0
iface eth0 inet dhcp

So that it looks like:

Now when you reboot, you will hopefully have a working internet connection!

Wireless
Just because it might be useful, I give a brief overview here.
If youre using wpa, then you need wpasupplicant package, which unfortunately isnt part of the
default install. Once you have the package, you need to edit /etc/network/interfaces to add
something like:
auto wlan0
iface wlan0 inet dhcp
wpa-ssid ATT123
wpa-psk MYPASSPHRASE

When you reboot, you should have an internet connection.

If you want to monitor DHCP communication between a DHCP server and a client, you can run
a packet sniffing tool on the same local network, and capture DHCP traffic. There are a couple of
sniffing tools you can use.

Method One
The first method to capture DHCP traffic is to use venerable tcpdump tool. In this case, you want
to define a filter so that tcpdump dumps only DHCP related traffic. In DHCP, UDP port number
67 is used by a DHCP server, and UDP port number 68 is used by DHCP clients. Thus, you want
to capture traffic with port number 67 or 68 as follows.
$ sudo tcpdump -i <network-interface> port 67 or port 68 -e -n

The above tcpdump output shows that IP address 172.16.253.131 is assigned to a client with
hardware address 00:0c:29:24:de:ee.

Method Two
The second method to monitor DHCP requests and responses is to use dhcpdump, which is a
command-line DHCP packet dumper program.
s
$ sudo tcpdump -i <network-interface> port 67 or port 68 -e -n

$ sudo dmidecode | more


$ sudo apt-get install dhcpdump

$ sudo dhcpdump -i <network-interface>

$ sudo dhcpdump -i eth0 -h ^00:c1:b5


The output shown by dhcpdump is more detailed than that of tcpdump. "YIADDR" field is
populated with the IP address offered by a DHCP server to a client, and "CHADDR" field is the
hardware address of the requesting client. It also shows other information such as DHCP lease
time, subnet mask, DNS server, etc.
can filter DHCP responses such that it captures only DHCP responses sent to a
particular hardware address.
dhcpdump

For example, the following command will capture DHCP response packets sent to client whose
hardware address starts with "00:c1:b5".

How do I troubleshoot networking on Debian


up vote 1 Today I restarted my linux box, and following the restart, my linux box has no
down
network connection.
vote
favorite Here's what I've tried so far:

1. Use an different ethernet cable that works on my other computer. No change.


2. In NetworkManager (KDE) remove and re-create the wired network
connection. Didn't work. I'm still getting system notifications in the lower
right corner of the screen saying
3. Network Interface
4. Connection New Wired Connection failed

5. > sudo /etc/init.d/networking restart It seemed to restart


successfully but still no network connection.

6. Checked /etc/network/interfaces. The only code in there is what the


internet says it's supposed to be:
7. auto lo
8.
9. iface lo inet loopback

10. Made sure it's not just a DNS issue by trying to ping one of google's public
DNS servers
11. $ ping 8.8.8.8
12. connect: Network is unreachable

Doesn't appear to be a DNS issue. 6. NEW Fix routing. I used the route command to
add a default gateway pointing to my router's IP address (thanks @chaos).
$ /sbin/route -n
Kernel IP routing table
Destination
Gateway
Use Iface
0.0.0.0
192.168.1.1
0 eth0

Genmask

Flags Metric Ref

0.0.0.0

UG

7. NEW See if I have an IP address


8. $ /sbin/ifconfig -a
9. eth0
Link encap:Ethernet HWaddr 74:d4:35:5f:0b:09
10.
inet6 addr: fe80::76d4:35ff:fe5f:b09/64 Scope:Link
11.
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
12.
RX packets:2999 errors:0 dropped:0 overruns:0 frame:0
13.
TX packets:0 errors:0 dropped:1711 overruns:0 carrier:0
14.
collisions:0 txqueuelen:1000
15.
RX bytes:365026 (356.4 KiB) TX bytes:0 (0.0 B)
16.
Interrupt:73 Base address:0xc000
17.
18.
19. lo
Link encap:Local Loopback
20.
inet addr:127.0.0.1 Mask:255.0.0.0
21.
inet6 addr: ::1/128 Scope:Host
22.
UP LOOPBACK RUNNING MTU:16436 Metric:1
23.
RX packets:4913 errors:0 dropped:0 overruns:0 frame:0
24.
TX packets:4913 errors:0 dropped:0 overruns:0 carrier:0
25.
collisions:0 txqueuelen:0
26.
RX bytes:1559718 (1.4 MiB) TX bytes:1559718 (1.4 MiB)
looks like I have an IPv6 address but not an IPv4 address? I would expect eth0

It
have a line starting with inet addr:, but it doesn't.
So how do I obtain an IP address?

to

Here's some more information that may (or may not) be helpful:
System info
$ uname -a
Linux mocha 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1 x86_64 GNU_Linux

Ethernet controller
$ lspci | grep -i eth
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)

What should I do next?


debian networking
asked Feb 3 '15 at
edited Feb 4 '15 at 7:03
2:02

shareimprove this
question

Muhammad
3141313

dinosaur
1236

I would try booting from a CD and see if it connects, to make sure this
is the Debian configuration that is at fault. Anthon Feb 3 '15 at 7:16
The Debian configuration is not at fault. I've been running it for
months with networking. Networking just broke after a recent restart.
dinosaur Feb 3 '15 at 19:35
browse /var/log/apt* and /var/log/dpkg* for any upgrades that
happened since your previous restart, i.e. anything that might have
gotten changed but not taken effect until you restarted. Kind of a long
shot, but maybe you installed something you forgot about.
drewbenn Feb 4 '15 at 0:57

add a comment
3 Answers
active oldest votes

I would (all this commands as root) ifconfig -a to check if the interface has an IP
address, if it doesn't you have found your problem, if it does, then I would netstat
-rn to check if the routes are right. If they are, I would iptables -L to check if there is
a firewall rule that is not letting me out. If they are all OK then maybe your IP address
doesn't belong to the router network.
up
vote 1
down
vote

answered Feb 3 '15 at 7:15

shareimprove this answer

YoMismo
2,009213
Could you please indicate how to fix the problems, e.g. if the interface
has no IP address or if the routes are wrong. dinosaur Feb 3 '15 at
19:25
If you have no IP you can either assign one manually, in which case you
should know the network segment where the router is and use a free IP
from that range (ifconfig eth0 192.168.1.15/24 replacing eth0 for your
interface and 192.168.1.15/24 for your address and networkmask) if you
want to try to get an IP from the DCHP server dhclient should get an
address for you. But it would be better to specify what you want in
/etc/network/interfaces and you will have your network connection up
and running whenever you start your machine. route add command will
allow you to set routes. YoMismo Feb 4 '15 at 7:38
add a comment

up
connect: Network is unreachable points to a missing route to that network (the
vote 1 default route in this case).
down
vote
Use:
route -n

To display the current routing table. There must be a route that looks like this:
Destination
Use Iface

Gateway

Genmask

Flags Metric Ref

0.0.0.0
0 eth0

<gateway-ip>

0.0.0.0

UG

Notice that, <gateway-ip> is the ip address of your router/gateway. And Iface may
also be different, when you have multiple network interfaces in your system.
However, add the default route manually with this command:
route add default gw <gateway-ip>

answered Feb 3 '15 at 8:37

shareimprove this answer

chaos
23.1k24282
add a comment
up
The issue here is that your wired interface (eth0) does not have an IPv4 address. You
vote 0 have manually added an IPv4 route but, without having an IPv4 address, traffic cannot
down get routed as it cannot assign an IP address for (your system's) source IP.
vote

Without knowing more information of your environment (Are you using a DSL
connection? Are you in an corporate network? Who should be providing you an IP
address?) I would guess that before the reboot you either have a staticly configured IP
address or a working DHCP server. If you had a staticly configured address (which your
configuration does not show) it was lost after the reboot.
You see an IPv6 address because that address is "auto-configured". Since you have not
configured it the wired interface just creates one that can be used to communicate with
the local network.
From the ifconfig information you provided it seems that your network card is receiving
Ethernet packets, but not sending any. Strangely, it is also showing many dropped
packets.
For starters, I would suggest you do the following:
1. Get information of your network IP addressing scheme. Ask your network

administrator, or check the information provided by your ISP. Alternatively, (if


you are bold) you can listen to the network traffic on the network by running
tcpdump -ni eth0 and try to guess your internal network addressing based on
the packets your system receives.
From now on lets assume that your network is in a private IP address range,
since this is quite common. Many networks nowadays are pre-configured in the
192.168.1.0/24 space range which means that the IP addresses start in
192.168.1.1 and end in 192.168.1.254
2. Configure your network interface with a static IP address and a gateway using
either Network Manager (i.e. through the desktop) or configuring
/etc/network/interfaces properly. This is described fully here in the Debian
Wiki.
Note: You can also configure it manually running ip addr add 192.168.1.15
dev eth0; ip route add default via 192.168.1.1. But this will not
survive a system reboot.
3. Try to see if you reach the gateway by sending it packets. This can be done
simply, assuming your gateway is 192.168.1.1 by running ping -c 10
192.168.1.1. If the command returns that all 10 tests worked OK then you can
see your gateway.
4. Then try to access a well known public IP address. For example a Google DNS
server, doing ping -c 10 8.8.8.8. If this does not work then try to run a
tracing test using traceroute -n 8.8.8.8 to see where your packets are being
dropped.
5. Finally, ensure that you can do DNS resolution properly by running host
www.google.com or ping -c 10 www.google.com
If all goes well up to step 5 I would suggest that, in order to diagnose future problems,
you install the ifupdown-extra package. This installs the network-test tool which does
many of the network tests listed above (and more) in order to diagnose if there is a
network problem or misconfiguration.
Once you can connect using a static IP address. Try to go back with what you previously
had which probably was a dynamic IP configuration using DHCP.

To do this:
1. Reconfigure the interface to use a dynamic IP address.
2. Wait for Network Manager to do its job. You will see in your Desktop
environment if it fails (or not) but you can also get detailed information in the
System logs. More specifically /var/log/syslog . Filtering for Network Manager
logs will tell you quite a lot of information, just run grep NetworkManager
/var/log/syslog and review the output.
3. Run network-test to see if you are properly connected
4. If you are not connected to the network try to manually ask for an IP address
running dhclient eth0 and see if that provides you with an IP address.
Based on the above tests you should have a better knowledge of what broke and what
works in your network and configure your system accordingly

dpkg problem: can't upgrade/configure procps package


Hi,
When ever I run "sudo apt-get upgrade" I get the following errors:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: warning: ignoring option --foreign-architecture=@MULTIARCH@: must start
with an alphanumeric
Setting up procps (1:3.2.8-11ubuntu6.3) ...
dpkg: warning: ignoring option --foreign-architecture=@MULTIARCH@: must start
with an alphanumeric
dpkg: warning: ignoring option --foreign-architecture=@MULTIARCH@: must start
with an alphanumeric
start: Job failed to start
invoke-rc.d: initscript procps, action "start" failed.
dpkg: error processing procps (--configure):
subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports has already been reached
dpkg: dependency problems prevent configuration of apache2.2-common:
apache2.2-common depends on procps; however:
Package procps is not configured yet.
dpkg: error processing apache2.2-common (--configure):
dependency problems - leaving unconfigured

No apport report written because MaxReports has already been reached


dpkg: dependency problems prevent configuration of apache2-mpm-worker:
apache2-mpm-worker depends on apache2.2-common (= 2.2.221ubuntu1.4+6.0trisquel2); however:
Package apache2.2-common is not configured yet.
dpkg: error processing apache2-mpm-worker (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports has already been reached
dpkg: dependency problems prevent configuration of apache2:
apache2 depends on apache2-mpm-worker (= 2.2.22-1ubuntu1.4+6.0trisquel2) |
apache2-mpm-prefork (= 2.2.22-1ubuntu1.4+6.0trisquel2) | apache2-mpm-event (=
2.2.22-1ubuntu1.4+6.0trisquel2) | apache2-mpm-itk (= 2.2.221ubuntu1.4+6.0trisquel2); however:
Package apache2-mpm-worker is not configured yet.
Package apache2-mpm-prefork is not installed.
Package apache2-mpm-event is not installed.
Package apache2-mpm-itk is not installed.
apache2 depends on apache2.2-common (= 2.2.22-1ubuntu1.4+6.0trisquel2);
however:
Package apache2.2-common is not configured yet.
dpkg: error processing apache2 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of apport-gtk:
No apport report written because MaxReports has already been reached
apport-gtk depends on procps; however:
Package procps is not configured yet.
dpkg: error processing apport-gtk (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports has already been reached
Errors were encountered while processing:
procps
apache2.2-common
apache2-mpm-worker
apache2
apport-gtk
E: Sub-process /usr/bin/dpkg returned an error code (1)

It seems procps is unconfigured. I have not managed to get it done. I have tried "sudo apt-get
install -f" and "dpkg --configure --pending" and re-installing it with Synaptics without success.
Can you help?
What's your output of
cat /etc/dpkg/dpkg.cfg.d/multiarch

It's:
foreign-architecture @MULTIARCH@

That doesn't make sense to me and apparently neither to dpkg. Edit the file as super user and put
a # in front of the line.
Then try updating and upgrading.
I don't think it had any effect.
Can anyone help me with this? The problem is related to procps and apport-gtk. I tried to install
apache and it failed due to procps.
(Re)move /etc/dpkg/dpkg.cfg.d/multiarch and post here the output of 'sudo apt-get upgrade'.
~$ mv /etc/dpkg/dpkg.cfg.d/multiarch .
~$ sudo apt-get upgrade
Setting up procps (1:3.2.8-11ubuntu6.3) ...
start: Job failed to start
invoke-rc.d: initscript procps, action "start" failed.
dpkg: error processing procps (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of apache2.2-common:
apache2.2-common depends on procps; however:
Package procps is not configured yet.
dpkg: error processing apache2.2-common (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of apache2-mpm-worker:
apache2-mpm-worker depends on apache2.2-common (= 2.2.221ubuntu1.4+6.0trisquel2); however:
Package apache2.2-common is not configured yet.
dpkg: error processing apache2-mpm-worker (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of apache2:
apache2 depends on apache2-mpm-worker (= 2.2.22-1ubuntu1.4+6.0trisquel2) |
apache2-mpm-prefork (= 2.2.22-1ubuntu1.4+6.0trisquel2) | apache2-mpm-event (=
2.2.22-1ubuntu1.4+6.0trisquel2) | apache2-mpm-itk (= 2.2.221ubuntu1.4+6.0trisquel2); however:
Package apache2-mpm-worker is not configured yet.
Package apache2-mpm-prefork is not installed.
Package apache2-mpm-event is nNo apport report written because the error
message indicates it's a follow-up error from a previous failure.
No apport report written because the error message indicates it's a follow-up
error from a previous failure.
No apport report written because MaxReports has already been reached
No apport report written because MaxReports has already been reached
ot installed.

Package apache2-mpm-itk is not installed.


apache2 depends on apache2.2-common (= 2.2.22-1ubuntu1.4+6.0trisquel2);
however:
Package apache2.2-common is not configured yet.
dpkg: error processing apache2 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of apport-gtk:
apport-gtk depends on procps; however:
Package procps is not configured yet.
dpkg: error processing apport-gtk (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
procps
apache2.2-common
apache2-mpm-worker
apache2
apport-gtk
E: Sub-process /usr/bin/dpkg returned an error code (1)

You now have another error: "procps" is not properly configured. What happened if you try
reinstalling that package?
I think the procps has been the cause for the problem for the whole time. I tried re-installing it
with synaptics and "sudo apt-get -f install" but I just got the same old error message like above:
Setting up procps (1:3.2.8-11ubuntu6.3) ...
start: Job failed to start
invoke-rc.d: initscript procps, action "start" failed.
dpkg: error processing procps (--configure):
subprocess installed post-installation script returned error exit status 1
.
.
.

What's your output of


cat /etc/sysctl.d/*.conf /etc/sysctl.conf | sudo sysctl -p -

and
cat /etc/apt/sources.list

cat /etc/sysctl.d/*.conf /etc/sysctl.conf | sudo sysctl -p kernel.printk = 4 4 1 7


net.ipv6.conf.all.use_tempaddr = 2
net.ipv6.conf.default.use_tempaddr = 2

kernel.kptr_restrict = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.tcp_syncookies = 1
kernel.yama.ptrace_scope = 1
vm.mmap_min_addr = 65536
error: "Is a directory" setting key "vm.swappiness."
vm.vfs_cache_pressure = 50
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_sack = 1
net.ipv4.tcp_no_metrics_save = 1
net.core.netdev_max_backlog = 2500

cat /etc/apt/sources.list
# deb http://es.archive.trisquel.info/trisquel/ toutatis main
# deb http://es.archive.trisquel.info/trisquel/ toutatis-updates main
# deb http://archive.trisquel.info/trisquel toutatis-security main
# See http://trisquel.info/wiki/ for how to upgrade to
# newer versions of the distribution.
# Uncomment this lines to enable the backports optional repository
# deb http://es.archive.trisquel.info/trisquel/ toutatis-backports main
deb http://es.archive.trisquel.info/trisquel/ toutatis main
deb http://archive.trisquel.info/trisquel/ toutatis-security main
deb http://es.archive.trisquel.info/trisquel/ toutatis-updates main
# deb-src http://es.archive.trisquel.info/trisquel/ toutatis-backports main
# Linux-libre PPA by jxself
deb http://jxself.org/repo/freesh/ freesh main
# Tomb PPA
# deb http://apt.dyne.org/ubuntu dyne main
# deb-src http://apt.dyne.org/ubuntu dyne main

error: "Is a directory" setting key "vm.swappiness." sounds fishy, could be the source of the
problems.
Let's try to find where it's set
grep swappiness /etc/sysctl.d/*.conf /etc/sysctl.conf

grep swappiness /etc/sysctl.d/*.conf /etc/sysctl.conf


/etc/sysctl.conf:vm.swappiness.=1

I recall writing this to the config file myself. I tried to improve system performance and protect
my SSD. I don't recall, though, adding a period there.
Removed the period and run "sudo apt-get install -f". Problem solved. Thanks a lot for your help
guys. I learned a lesson here: typos are a bad thing to have in configuration files.
Glad to hear that!
As they say, the devil is in the details. :)
I would try executing that:
$ sudo dpkg-reconfigure procps