Networking Forums

Networking Forums > Computer Networking > Linux Networking > Connecting two private networks

Reply
Thread Tools Display Modes

Connecting two private networks

 
 
Simon Kissane
Guest
Posts: n/a

 
      02-06-2006, 10:14 PM
Hi

I am have a two boxes connected together with a 1Gbps ethernet
crossover link. One of the boxes is on a wireless network. I'm trying
to get routing set up so I can use the wireless network from the box
which doesn't have the card in it...

My network is set up as follows:
- cable modem is connected to a D-Link wireless router/switch
(192.168.0.1)
- Linux box (FC4) has a D-Link wireless card in it (192.168.0.102),
using madwifi & wpa_supplicant, and a 1GBps ethernet card (eth0,
192.168.39.1)
- Windows box has a 1GBps ethernet card (192.168.39.120)

What I would like to do is something like this (is this possible?):
- configure the Linux box to advertise via ARP both its IP & the
Windows box's IP for its wireless MAC address
- route the packets it receives for the Window's box's IP through its
ethernet interface to the windows box.

I have the routing set up, but how do I do the ARP stuff?

I have also thought about using bridge-utils/ebtables, but I'd rather
not use bridging unless I have to...

Many thanks

Simon

 
Reply With Quote
 
 
 
 
Allen McIntosh
Guest
Posts: n/a

 
      02-06-2006, 11:48 PM
> What I would like to do is something like this (is this possible?):
> - configure the Linux box to advertise via ARP both its IP & the
> Windows box's IP for its wireless MAC address
> - route the packets it receives for the Window's box's IP through its
> ethernet interface to the windows box.
>
> I have the routing set up, but how do I do the ARP stuff?
>
> I have also thought about using bridge-utils/ebtables, but I'd rather
> not use bridging unless I have to...


You could get the Linux box to proxy arp (in 2.4 kernels it's a setting
in /proc/sys, haven't looked at 2.6) but
1) how does the router know to send 192.168.39 traffic back? (I've had
one that would do this automagically, and one that wouldn't)
2) why not just configure NAT?
 
Reply With Quote
 
Simon Kissane
Guest
Posts: n/a

 
      02-07-2006, 12:27 AM
Thanks for your response,

Allen McIntosh wrote:
[snip]
> You could get the Linux box to proxy arp (in 2.4 kernels it's a setting
> in /proc/sys, haven't looked at 2.6) but
> 1) how does the router know to send 192.168.39 traffic back? (I've had
> one that would do this automagically, and one that wouldn't)

I don't know whether it will or won't... I'm hoping

> 2) why not just configure NAT?

Well, I could do that. I was wondering if there was an alternative...
(Its been a couple of years since I last seriously touched iptables,
and I'm not rushing to play with it again

Cheers
Simon

 
Reply With Quote
 
Postmaster
Guest
Posts: n/a

 
      02-07-2006, 12:36 AM

"Simon Kissane" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Thanks for your response,
>
> Allen McIntosh wrote:
> [snip]
>> You could get the Linux box to proxy arp (in 2.4 kernels it's a setting
>> in /proc/sys, haven't looked at 2.6) but
>> 1) how does the router know to send 192.168.39 traffic back? (I've had
>> one that would do this automagically, and one that wouldn't)

> I don't know whether it will or won't... I'm hoping
>
>> 2) why not just configure NAT?

> Well, I could do that. I was wondering if there was an alternative...
> (Its been a couple of years since I last seriously touched iptables,
> and I'm not rushing to play with it again
>
> Cheers
> Simon
>


Simon,

Machine "A" has Internet access, and also a private LAN.
Machine "B" has only private LAN.

Machine "A" can provide NAT for all the machines on the private
LAN by doing doing something like:

------------------------------------------
LOCALNETWORK="10.0.100.0/24"
EXTINT="eth1" #The external interface
INTINT="eth0" #The internal interface
PUBLICPORTS="1056:65535"

#
# Allow forwarding from inside to out and vice versa
#
/sbin/iptables -A FORWARD -i $INTINT -s $LOCALNETWORK -j ACCEPT
/sbin/iptables -A FORWARD -o $INTINT -d $LOCALNETWORK -j ACCEPT

/sbin/iptables -t nat -A POSTROUTING -o $EXTINT -s $LOCALNETWORK \
-j MASQUERADE
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A OUTPUT -o lo -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -i lo -j ACCEPT
/sbin/iptables -t nat -A POSTROUTING -o lo -j ACCEPT
/sbin/iptables -t nat -A OUTPUT -o lo -j ACCEPT

/sbin/iptables -A INPUT -i $INTINT -s $LOCALNETWORK -j ACCEPT
/sbin/iptables -A OUTPUT -o $INTINT -d $LOCALNETWORK -j ACCEPT

/sbin/iptables -t nat -A OUTPUT -s $LOCALNETWORK -j ACCEPT
/sbin/iptables -t nat -A POSTROUTING -o $INTINT -s $LOCALNETWORK \
-j ACCEPT
/sbin/iptables -t nat -A POSTROUTING -o lo -s $LOCALNETWORK \
-j ACCEPT
/sbin/iptables -t nat -A PREROUTING -s $LOCALNETWORK -j ACCEPT

/sbin/iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

/sbin/iptables -A INPUT -i $EXTINT -p TCP ! --syn --sport $PUBLICPORTS \
--dport $PUBLICPORTS -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A OUTPUT -o $EXTINT -p TCP --sport $PUBLICPORTS \
--dport $PUBLICPORTS -m state --state NEW,ESTABLISHED -j ACCEPT
/sbin/iptables -t nat -A OUTPUT -o $EXTINT -p TCP --sport $PUBLICPORTS \
--dport $PUBLICPORTS -m state --state NEW,ESTABLISHED -j ACCEPT
/sbin/iptables -t nat -A POSTROUTING -o $EXTINT -p TCP --sport $PUBLICPORTS
\
--dport $PUBLICPORTS -m state --state NEW,ESTABLISHED -j ACCEPT
/sbin/iptables -t nat -A POSTROUTING -o lo -p TCP --sport $PUBLICPORTS \
--dport $PUBLICPORTS -j ACCEPT

echo 1 > /proc/sys/net/ipv4/ip_forward
------------

Enjoy
Postmaster


 
Reply With Quote
 
Simon Kissane
Guest
Posts: n/a

 
      02-07-2006, 09:36 AM
Allen McIntosh wrote:
[snip]
> You could get the Linux box to proxy arp (in 2.4 kernels it's a setting
> in /proc/sys, haven't looked at 2.6) but
> 1) how does the router know to send 192.168.39 traffic back? (I've had
> one that would do this automagically, and one that wouldn't)
> 2) why not just configure NAT?


I got proxy arp to work by doing the following:
sysctl -w 'net.ipv4.conf.ath0.proxy_arp=1'
sysctl -w 'net.ipv4.ip_forward=1'
ip neigh add proxy 192.168.39.120 dev ath0

unfortunately, you were right, my router only recognises the
192.168.0.* subnet as being on the private side, and nothing I can do
will change it... maybe i'll just have to use NAT after all.

 
Reply With Quote
 
Steve Horsley
Guest
Posts: n/a

 
      02-10-2006, 11:23 PM
Simon Kissane wrote:

> What I would like to do is something like this (is this possible?):
> - configure the Linux box to advertise via ARP both its IP & the
> Windows box's IP for its wireless MAC address
> - route the packets it receives for the Window's box's IP through its
> ethernet interface to the windows box.
>
> I have the routing set up, but how do I do the ARP stuff?


Make sure you have enabled routing on the Linux box?
http://www.yolinux.com/TUTORIALS/Lin...tml#FORWARDING


>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What Is It With 192.168 And Private Networks? (PeteCresswell) Wireless Networks 3 01-27-2011 01:35 AM
Private Networks for Higher Security International Alliance Privacy Services Windows Networking 0 01-26-2009 02:55 AM
Router with two private networks Ted B Network Routers 1 01-12-2007 08:32 AM
Connecting two Class C private networks under one domain. =?Utf-8?B?bW9zcXVpdG9faGlwcHk=?= Windows Networking 8 12-09-2004 01:17 PM
OpenVPN: Connecting 2 private networks Frank Elsner Linux Networking 1 05-17-2004 08:24 AM



1 2 3 4 5 6 7 8 9 10 11