dhcp in linux

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
ok i have my /etc/network/interfaces like this:

auto eth0
iface etho inet dhcp

(thats from memory, ignore any small mistakes, you get the point)

and then i'm using dhclient, i do a dhclient eth0, and it appears to go fine, i do /etc/init.d/networking restart, it appears to go fine, and then i still have no IP when i check ifconfig.

not sure what to do here........
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
You may need to add the hostname to /etc/dhclient.conf for the DHCP server to give you an IP.
 

wuboy

Member
Feb 28, 2002
59
0
0
additional to what nothinman suggests,

you can also check your /etc/sysconfig/network-scripts/ifcfg-eth* file (i think that's what it is).
for the BOOTPROTO= line, u can use BOOTPROTO=dhcp, and make sure the rest of ur fields are set correctly (BROADCAST, NETWORK, etc)

set ONBOOT=yes so that it will load at startup.

if you do not want to restart, you'll have to tinker with the ifconfig stuff... such as ifconfig eth0 up.

hope this helps
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
hm...hostname doesnt matter, my hostname in windows is 'ass'....and in my /etc/dhclient.conf file, everything is commented out, it seems that it's supposed to commented out though.

and wuboy, i have no /etc/sysconfig directory, and a "find / -name *ifcfg* -print" yields nothing, and neither do similar searches, this is on debian btw.
 

wuboy

Member
Feb 28, 2002
59
0
0

haha my mistake. im not too good with debian, so sorry cant help u there...

im going to try using debian on a spare machine sometime in the future tho =)

good luck!!
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Try running dhclient -d eth0 and see if it prints anything that might give you a clue why it's failing.

Also if you compiled a custom kernel did you make sure to include Packet Socket?
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0


<< Try running dhclient -d eth0 and see if it prints anything that might give you a clue why it's failing.

Also if you compiled a custom kernel did you make sure to include Packet Socket?
>>


lemme try the first one....the second one, well, hrm i dont know, i'll have to check my kernel config.

/me hits the power switch
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
ok...."dhclient -d eth0" also does not output any error or anything, and again i get the /var/run/dhclient.pid not found error when restarting networking...

i do have packet socket enabled in my kernel...the "mmapped IO" option was not enabled, if that means anything.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
You shouldn't need to restart networking after running dhclient, infact taht might cause problems because /etc/init.d/networking runs 'ifup -a' which might try to run dhclient again, especially if the pid file is missing.

Check /var/log/daemon.log, you should atleast have lines like: Feb 21 14:10:41 hostname dhclient-2.2.x: DHCPREQUEST on eth0 to 255.255.255.255 port 67
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
well it looks like i've found the problem


<< Mar 1 19:55:41 cmc1827691-b dhclient-2.2.x: socket: Protocol not available - make sure CONFIG_PACKET and CONFIG_FILTER are defined in your kernel configuration! >>


i could have cought that earlier but being the n00b i am i was not aware of daemon.log, i only knew of /var/log/messages, guess i didnt snoop around in /var/log enough :p

so it looks like i need config_packet and config_filter, also, does the 2.2.x version of dhclient happen to mean that its meant for 2.2 kernels? i hope not :Q
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
ok config_packet was already on, and then i compiled in config_filter, and rebooted to the new kernel, but alas i had the same problem. :(

time for some sim city 3000
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Here's my network section of .config:

#
# Networking options
#
CONFIG_PACKET=y
CONFIG_PACKET_MMAP=y
CONFIG_NETLINK_DEV=y
CONFIG_NETFILTER=y
# CONFIG_NETFILTER_DEBUG is not set
CONFIG_FILTER=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
# CONFIG_IP_ADVANCED_ROUTER is not set
# CONFIG_IP_PNP is not set
# CONFIG_NET_IPIP is not set
# CONFIG_NET_IPGRE is not set
# CONFIG_IP_MROUTE is not set
# CONFIG_ARPD is not set
# CONFIG_INET_ECN is not set
CONFIG_SYN_COOKIES=y
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
If you have another box with a network connection you could download the pump .deb and see if it works any better.