Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
iptables,routing, multiple subnets, need help
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
linux_on_the_brain
Tux's lil' helper
Tux's lil' helper


Joined: 24 Feb 2004
Posts: 136

PostPosted: Tue Dec 28, 2004 8:49 am    Post subject: iptables,routing, multiple subnets, need help Reply with quote

Ok so here is situation.
I added a gigabit ethernet card to my server. And attached it to a gigabit switch I have dhcp setup and working, finally. Here is what I dont have working. I cant get to the internet via the new subnet nor can I ping between subnets. My firewall is based on the example given in the masquerade howto I found on tldp.org. I've been reading posts on the forums for about three days and I have not been able to figure out what I need to do. If somebody could he me out, I would appreciate it.
Back to top
View user's profile Send private message
br0mGreV
Apprentice
Apprentice


Joined: 28 Jul 2004
Posts: 265
Location: Paris, France

PostPosted: Tue Dec 28, 2004 9:18 am    Post subject: Reply with quote

Have you set your routes correctly ?

Code:
 # route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
loopback        localhost       255.0.0.0       UG    0      0        0 lo
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth0


_________________
Rien n'est éternel, pas même les problèmes...
Back to top
View user's profile Send private message
Anarcho
Advocate
Advocate


Joined: 06 Jun 2004
Posts: 2970
Location: Germany

PostPosted: Tue Dec 28, 2004 10:44 am    Post subject: Reply with quote

did you enable IP-Forwarding?

check this via
Code:
cat /proc/sys/net/ipv4/ip_forward
(or similar, I am currently at a windows pc)

if it says 0 then you have to enable it via

Code:
echo 1 > /prov/sys/net/ipv4/ip_forward

_________________
...it's only Rock'n'Roll, but I like it!
Back to top
View user's profile Send private message
linux_on_the_brain
Tux's lil' helper
Tux's lil' helper


Joined: 24 Feb 2004
Posts: 136

PostPosted: Tue Dec 28, 2004 4:51 pm    Post subject: Reply with quote

ip_forwarding is enabled

this is the results of route from the server
Code:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     0      0        0 eth2
192.168.0.0     *               255.255.255.0   U     0      0        0 eth1
user-0c8hqg0.ca *               255.255.255.0   U     0      0        0 eth0
loopback        localhost       255.0.0.0       UG    0      0        0 lo
default         user-0c8hqg1.ca 0.0.0.0         UG    0      0        0 eth0


and from one of the workstations on subnet 192.168.0
Code:

 route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 eth1
loopback        localhost       255.0.0.0       UG    0      0        0 lo
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth1
Back to top
View user's profile Send private message
plut0
Apprentice
Apprentice


Joined: 21 Dec 2004
Posts: 272

PostPosted: Tue Dec 28, 2004 5:08 pm    Post subject: Reply with quote

Did you add a MASQUERADE or SNAT rule to your firewall for NAT?
Back to top
View user's profile Send private message
linux_on_the_brain
Tux's lil' helper
Tux's lil' helper


Joined: 24 Feb 2004
Posts: 136

PostPosted: Tue Dec 28, 2004 6:01 pm    Post subject: Reply with quote

plut0, thats part of the problem. I'm not sure what I need to change or add to my firewall rules.

Currently I have this, which works for my network prior to adding the second subnet.
Code:

$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j SNAT --to $EXTIP
Back to top
View user's profile Send private message
plut0
Apprentice
Apprentice


Joined: 21 Dec 2004
Posts: 272

PostPosted: Wed Dec 29, 2004 12:15 am    Post subject: Reply with quote

Remove the SNAT line for now and try this:

iptables -t nat -I POSTROUTING -j MASQUERADE

That should pick up all ethernet devices, not just eth0 as your rule states. Without Network Address Translation your packets would be sent out with the wrong source and thus never returned.
Back to top
View user's profile Send private message
linux_on_the_brain
Tux's lil' helper
Tux's lil' helper


Joined: 24 Feb 2004
Posts: 136

PostPosted: Wed Dec 29, 2004 12:44 am    Post subject: Reply with quote

i've made some progress I can now get to the internet from the second subnet. Now I need to work on getting communication between the 2 subnets.
Back to top
View user's profile Send private message
digitall2000
Apprentice
Apprentice


Joined: 21 Dec 2004
Posts: 267

PostPosted: Wed Dec 29, 2004 4:53 am    Post subject: Reply with quote

well as far as i understand this on the subnet thing
if you have one nic card with one address you cannot
talk to the other subnet through the switch it is on a
different network.

if you have a fancy swithch it may do the routing necessary
to get to the other subnet.

maybe alias (virtual) address on the nic card may work
Back to top
View user's profile Send private message
linux_on_the_brain
Tux's lil' helper
Tux's lil' helper


Joined: 24 Feb 2004
Posts: 136

PostPosted: Wed Dec 29, 2004 4:16 pm    Post subject: Reply with quote

I can now ssh and ping between the subnets, I think I have acheived my goal for now.
Back to top
View user's profile Send private message
br0mGreV
Apprentice
Apprentice


Joined: 28 Jul 2004
Posts: 265
Location: Paris, France

PostPosted: Wed Dec 29, 2004 4:32 pm    Post subject: Reply with quote

nice job lol,

but for those who search the forum and wants to get this type of information, could you sum up the importants rules from iptables you have written.
_________________
Rien n'est éternel, pas même les problèmes...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum