[Samba] Any pointers for multiple subnets?

Nandan Bhat nlbhat at gmail.com
Wed Apr 11 11:03:54 GMT 2007


Hi,

I am trying to have some routing done between two subnets. One is 
192.168.1.0/24 and has my LAN computers running a mix of Windows 98/XP 
clients. There are two linux machines on this network running Samba. 
Another is 192.168.0.0/24 and has the other LAN. Only my linux machines 
have two NICs, one for each LAN.

I am trying out one of these linux machines to be the gateway for both 
the LANs. My routing table is as follows

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use 
Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

At present, I am testing my system, so I have adopted a VERY liberal 
iptables ruleset.  It has the following entries

#! /bin/sh
#
# definitions
IPTABLES=/sbin/iptables
DEPMOD=/sbin/depmod
MODPROBE=/sbin/modprobe
EXTIF="eth1"
INTIF="eth0"
UNIVERSE=0.0.0.0/0
#
# Load modules
$DEPMOD -a
$MODPROBE ip_tables
$MODPROBE ip_conntrack
$MODPROBE ip_conntrack_ftp
$MODPROBE ip_conntrack_irc
$MODPROBE iptable_nat
$MODPROBE ip_nat_ftp
$MODPROBE ip_nat_irc
#
# Enable IP forwarding
echo "1" > /proc/sys/net/ipv4/ip_forward
#
# Begin iptables rules
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -F FORWARD
$IPTABLES -t nat -F
#$IPTABLES -A INPUT -j ACCEPT
#$IPTABLES -A OUTPUT -j ACCEPT
#$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -j ACCEPT
#$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
#$IPTABLES -A FORWARD -j LOG
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
$IPTABLES -t nat -A POSTROUTING -o $INTIF -j MASQUERADE

With this setup, some things work as desired. I am able to connect to 
192.168.0.10 (Email server) from 192.168.1.5 after setting my linux box 
as the gateway. Vice versa, I am able to connect to 192.168.1.6 (Email 
server) from 192.168.0.2 by setting 192.168.0.177 (my linux box's IP on 
outside LAN).

I am beginning to think so far so good. But, Windows networking does  
not follow suit. I am not able to browse the network when these settings 
are active.

What gives? My guess is I will be castigated for rushing with an email 
before reading the Archives.

But hope springs eternal. Regards,

Nandan



More information about the samba mailing list