You are not logged in.

#1 2012-11-20 20:18:03

n0rv
Member
Registered: 2012-02-27
Posts: 50

Sharing connection with dhcp server - problem

I try to share internet connection from my PC (Arch) to my laptop (Win7) like here: https://wiki.archlinux.org/index.php/Internet_Share and here: https://wiki.archlinux.org/index.php/Dhcpd, because I need to have dhcp server.
I don't have permission to change any network settings on my laptop, I can configure Linux only.

My dhcp config:

subnet 10.0.0.0 netmask 255.255.255.0 {
	range 10.0.0.2 10.0.0.255;
}

I configured interface:

ifconfig eth1 10.0.0.1

I enabled packet forwarding:

sysctl net.ipv4.ip_forwarding=1

I configured iptables:

iptables -t nat -A POSTROUTING -o internet0 -j MASQUERADE

Dhcp server run without problem.

In effect, my laptop have dhcp server address, have own ip, but gateway address is empty. Network unidentified.

What is wrong? If I connect directly to my router, internet on laptop works fine.

Any (easy and clear) manual or something?

Last edited by n0rv (2012-11-20 20:34:30)

Offline

#2 2012-11-20 22:18:51

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,237
Website

Re: Sharing connection with dhcp server - problem

You need further configuration in your DHCP config; for starters, you need to include the gateway address, and some DNS servers would help too. Don't forget the "authoritative" directive at the top of your DHCP conf too.

Offline

#3 2012-11-20 23:34:38

n0rv
Member
Registered: 2012-02-27
Posts: 50

Re: Sharing connection with dhcp server - problem

Ok, I update dhcpd.conf:

authotitative;
option routers 10.0.0.1;
option domain-name-servers 208.67.222.222;
subnet 10.0.0.0 netmask 255.255.255.0 {
	range 10.0.0.2 10.0.0.255;
}

but nothing happened tongue

Problem was in iptables config, I should use:

iptables --append FORWARD --in-interface eth0 -j ACCEPT
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --table nat --append POSTROUTING --out-interface eth1 -j MASQUERADE

and now it works!

Offline

#4 2012-11-21 22:08:01

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,237
Website

Re: Sharing connection with dhcp server - problem

Glad you figured it out smile
You don't need to masquerade traffic out eth1 interface though. You've got a typo in "authoritative" too.

EDIT: Also, avoid OpenDNS

Last edited by fukawi2 (2012-11-21 22:09:16)

Offline

Board footer

Powered by FluxBB