Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have 3 network cards installed in my ubuntu 10.04 server and I want to configure Internet sharing and file sharing on eth1 for wired users and wlan0 for wireless users.

Static ip:
eth0: 192.168.1.1
eth1: 10.0.0.15
wlan0: 10.0.0.20

/etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.15
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1


#The secondary network interfaces
auto eth1
iface eth1 inet static
address 10.0.0.15
netmask 255.0.0.0
network 10.0.0.0
broadcast 10.255.255.255

auto wlan0
iface wlan0 inet static
address 10.0.0.20
netmask 255.0.0.0
network 10.0.0.0
broadcast 10.255.255.255

I have use squid and dansguardian for internet configured

I have configure following in hostapd /etc/hostapd/hostapd.conf with WPA authentication options.

01 interface=wlan0
02 driver=nl80211
03 ssid=dontMessWithVincentValentine
04 hw_mode=g
05 channel=6
06 macaddr_acl=0
07 auth_algs=1
08 ignore_broadcast_ssid=0
09 wpa=3
10 wpa_passphrase=KeePGuessinG
11 wpa_key_mgmt=WPA-PSK
12 wpa_pairwise=TKIP
13 rsn_pairwise=CCMP

DHCP server also configured (/etc/dhcp3/dhcpd.conf)

ddns-update-style none;
ignore client-updates;
authoritative;
option local-wpad code 252 = text;
subnet 10.0.0.0 netmask 255.255.255.0 {
# --- default gateway
option routers 10.0.0.15;
# --- Netmask
option subnet-mask 255.255.255.0;
# --- Broadcast Address
option broadcast-address 10.0.0.255;
# --- Domain name servers, tells the clients which DNS servers to use.
option domain-name-servers 10.0.0.15, 127.0.0.1, 192.168.1.1;
option time-offset 0;
range 10.0.0.21 10.0.0.30;
default-lease-time 1209600;
max-lease-time 1814400;
}

/etc/default/dhcp3-server

INTERFACES="eth1 wlan0"

I have enable packet forwarding for IPv4 and IPv6 (/etc/sysctl.conf)

Net.ipv4.ip_forward = 1
Net.ipv6.conf.all.forwarding = 1

/etc/rc.local

iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 8080
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

The client pc are able to receive Internet sharing on eth1 and also dhcp address and ping the other network.

From wlan to client pc are able to receive dhcp address but are not able to ping to 10.0.0.20 through which they are receivng dhcp address or any other pc in the network My firewall is also not enable.

What can be the problem why the wireless lan users are not able to ping or communicate Want to configure as a firewall plus router through which can share internet to cable connected user as well as wireless user.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

All the clients are told by DHCP server to use the eth1 IP address as gateway, but that address isn't reachable by Wi-Fi clients, thus they cannot be routed to other networks. Wi-Fi clients can't even ping wlan0 address because both eth1 and wlan0 are on the same subnet and wired interfaces take precedence over wireless interfaces, thus the ping reply get out by eth1 and nerver reaches the wireless client.

You must separate eth1 and wlan0 subnets and configure DHCP accordingly.

/etc/network/interfaces:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
 address 192.168.1.15
 netmask 255.255.255.0
 gateway 192.168.1.1

#The secondary network interfaces
auto eth1
iface eth1 inet static
 address 10.0.0.15
 netmask 255.255.255.0

auto wlan0
iface wlan0 inet static
 address 10.0.1.15
 netmask 255.255.255.0

/etc/dhcp3/dhcpd.conf:

ddns-update-style none;
ignore client-updates;
authoritative;
default-lease-time 1209600;
max-lease-time 1814400;
option local-wpad code 252 = text;
option domain-name-servers 192.168.1.15;
option time-offset 0;

subnet 10.0.0.0 netmask 255.255.255.0 {
  option routers 10.0.0.15;
  range 10.0.0.21 10.0.0.30;
}

subnet 10.0.1.0 netmask 255.255.255.0 {
  option routers 10.0.1.15;
  range 10.0.1.21 10.0.1.30;
}
share|improve this answer
    
Hi Thanks for the help just some more douts to clear –  kam gos Sep 12 '12 at 5:53
    
Hi Thanks some more douts breaking in 2 comments box as the characters are increasing I tried to configure dhcp with same subnet mask for both the eth1 255.0.0.0 and wlan0 255.0.0.0 but gave me bad subnet mask error so i change wlan0 subnet mask to 255.255.255.0 than dhcp service started why didnt I recive the eror while configuring in /etc/network/interfaces the eth1 and wlan0 I receive error if i try to configure wlan0 to other than 255.255.255.0 subnetmask –  kam gos Sep 12 '12 at 6:42
    
Also one more thing my internet connection is working on wireless clients I havent configure anything still it works fine for wire network eth1 this was not the case I have to configure it write 2 lines of iptables to redirect to port 80 Also it is not going through squid not able to fine how it is able to share internet through wlan0 can to tell me from where its is sharing internet ?? I want the wireless client internet to go through squid and dansguardian Also can you tell me the iptables line that should i used to for eth1 and wlan0 when it will shares internet through dansquardian –  kam gos Sep 12 '12 at 6:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.