LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   dhcp and internet sharing connectin problem (https://www.linuxquestions.org/questions/linux-networking-3/dhcp-and-internet-sharing-connectin-problem-250845/)

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:

/etc/conf.d/net
Code:

ifconfig_eth0=(
"192.168.1.78 broadcast 192.168.1.255 netmask 255.255.255.0"
)

ifconfig_eth1=( "dhcp" )

/etc/conf.d/dnsmasq
Code:

DNSMASQ_OPTS="--interface=eth0 -F 192.168.0.2,192.168.0.254"
/etc/dhcpd.conf
Code:

subnet 192.168.1.0 netmask 255.255.255.0 {
  ddns-update-style interim;
  range 192.168.1.10 192.168.1.100;
  default-lease-time 76400;
  max-lease-time 86400;
  option routers 192.168.1.78;
  option ip-forwarding on;
  option broadcast-address 192.168.1.255;
  option subnet-mask 255.255.255.0;
  option domain-name-servers 192.168.1.1 204.127.198.4, 63.240.76.4;
  option domain-name "akbarhome.com";
  option netbios-name-servers 192.168.1.1;
}

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 192.168.1.78 [ 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 192.168.1.0/255.255.255.0 -o eth0 -j SNAT --to-source 192.168.1.78

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

melinda_sayang 11-03-2004 11:11 PM

Code:

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 ftp.isc.org, please
Nov  4 18:09:14 [dhcpd] get the latest from ftp.isc.org 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 ftp.isc.org 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 dhcp-server@isc.org
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 "shadownet.org";
#option domain-name-servers 192.168.0.1;

option wpad-url code 252 = text;
option wpad-url "http://wpad.shadownet.org/wpad.dat";

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.
authoritative;

# 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 10.152.187.0 netmask 255.255.255.0 {
#}

# This is a very basic subnet declaration.

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.10 192.168.0.254;
option routers rtr.shadownet.org;
option domain-name "shadownet.org";

...

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

IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE

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.