-   Linux - Networking (
-   -   dhcp and internet sharing connectin problem (

melinda_sayang 11-03-2004 09:38 PM

dhcp and internet sharing connectin problem
I have Gentoo ( as server ) and Windows XP ( as client ). Gentoo has two interface cards. eth0 and eth1. Eth0 is for wan and eth1 is for lan. Gentoo has internet connection from ISP and I want to share it with Windows XP ( client ). I want it that way so Windows XP grab internet connection ( and ip address ) from Gentoo ( server ) with dhcp way automatically. No need to configure ip address manually in client. Just set it to obtain ip address automatically. Here is the detail of the server:


" broadcast netmask"

ifconfig_eth1=( "dhcp" )


DNSMASQ_OPTS="--interface=eth0 -F,"

subnet netmask {
  ddns-update-style interim;
  default-lease-time 76400;
  max-lease-time 86400;
  option routers;
  option ip-forwarding on;
  option broadcast-address;
  option subnet-mask;
  option domain-name-servers,;
  option domain-name "";
  option netbios-name-servers;

Then I do this step:
# /etc/init.d/net.eth1 restart
* Bringing eth1 down ...
* Removing inet6 addresses
* eth1 inet6 del fe80::205:blabla:fe31:dbfb/64 [ ok ]
* Releasing DHCP lease for eth1 [ ok ]
* Stopping eth1 [ ok ]
* Bringing eth1 up ...
* eth1 dhcp [ ok ]
# /etc/init.d/net.eth0 restart
* Stopping eth0
* Bringing down eth0
* Removing inet6 addresses
* eth0 inet6 del fe80::2e0:blabla:fe00:1936/64
* Shutting down eth0 ... [ ok ]
* Starting eth0
* Bringing up eth0
* eth0 [ ok ]
# /etc/init.d/dnsmasq restart
* Stopping dnsmasq ... [ ok ]
* Starting dnsmasq ... [ ok ]
# /etc/init.d/dhcp restart
* Setting ownership on dhcpd.leases ... [ ok ]
* Starting dhcpd ... [ !! ]

So how do I know what's wrong?????

And if I success to run dhcp server, what iptables command ( script ) must I run so that Windows XP ( client ) can connect to internet through Gentoo with medium security?

Thank you.

ashamril 11-03-2004 09:57 PM

i never use gentoo b4, but u can try look at the log, maybe /var/log/messages to check what went wrong with ur dhcpd

and for iptables try this

iptables -A POSTROUTING -s -o eth0 -j SNAT --to-source

make sure your /proc/sys/net/ipv4/ip_forward = 1

melinda_sayang 11-03-2004 11:11 PM


Nov  4 18:09:06 [su(pam_unix)] session opened for user root by knight(uid=1000)
Nov  4 18:09:14 [dhcpd] ** You must add a ddns-update-style statement to /etc/dhcp/dhcpd.conf.
Nov  4 18:09:14 [dhcpd] To get the same behaviour as in 3.0b2pl11 and previous
Nov  4 18:09:14 [dhcpd] versions, add a line that says "ddns-update-style ad-hoc;"
Nov  4 18:09:14 [dhcpd] Please read the dhcpd.conf manual page for more information. **
Nov  4 18:09:14 [dhcpd] If you did not get this software from, please
Nov  4 18:09:14 [dhcpd] get the latest from and install that before
Nov  4 18:09:14 [dhcpd] requesting help.
Nov  4 18:09:14 [dhcpd] If you did get this software from and have not
Nov  4 18:09:14 [dhcpd] yet read the README, please read it before requesting help.
Nov  4 18:09:14 [dhcpd] If you intend to request help from the
Nov  4 18:09:14 [dhcpd] mailing list, please read the section on the README about
Nov  4 18:09:14 [dhcpd] submitting bug reports and requests for help.
Nov  4 18:09:14 [dhcpd] Please do not under any circumstances send requests for
Nov  4 18:09:14 [dhcpd] help directly to the authors of this software - please
Nov  4 18:09:14 [dhcpd] send them to the appropriate mailing list as described in
Nov  4 18:09:14 [dhcpd] the README file.
Nov  4 18:09:14 [dhcpd] exiting.

So how do I fix my dhcp server problem? I don't understand this....

ignarus 11-04-2004 01:05 PM

try setting this line in your dhcpd.conf:

ddns-update-style ad-hoc;

DONT set it in your subnet declaration as you have done but put it at the top of your dhcpd.conf. Extract from my dhcpd.conf:

# dhcpd.conf
# Sample configuration file for ISC dhcpd

# option definitions common to all supported networks...
#option domain-name "";
#option domain-name-servers;

option wpad-url code 252 = text;
option wpad-url "";

ddns-update-style ad-hoc;

default-lease-time 600;
max-lease-time 7200;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.

#subnet netmask {

# This is a very basic subnet declaration.

subnet netmask {
option routers;
option domain-name "";


By the way, is your routing working now?
I use masquarading instead of source nat:


I would be surprised if source nat would work for your purposes.

ignarus 11-04-2004 01:09 PM

I made a mistake about the nat problem. Since you're using a static ip, source nat is okay ;)

melinda_sayang 11-05-2004 07:13 AM

Hi, my internet sharing connection works perfect now by using dnsmasq. No need dhcp server. By the way, thanx for your help. If I need help using dhcp server, I will read this thread.

All times are GMT -5. The time now is 05:44 AM.