LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 03-27-2004, 07:06 PM   #1
Dataforce
Member
 
Registered: Nov 2003
Distribution: Redhat 9
Posts: 38

Rep: Reputation: 15
Internal Routing eth1 to eth0


I have 2 NICs in my machine.
1 is eth0 and is assigned the IPs 192.168.0.5 (eth0) and 192.168.0.7 (eth0:0)
the other 1 is eth1 assigned the IPs 192.168.0.25 (eth1) and 82.133.***.*** (eth0:0 - masked)

I have NAT configureed and working.

the assignment of 82.133.***.*** is simply so that when l goto my external IP from another machine on my LAN , it actually gets somewhere (my Router, a zoom X3, drops outgoing conenctions to the WAN ip)

The router has 192.168.0.25 set as a DMZ. (so eth1 is used for anything related to the external IP and eth0 is the internal LAN)

I have setup some portforwards so that 192.168.0.25:80 or 82.133.***.***:80 get redirected to 192.168.0.5:80.

This workd for internal Clients and external clients, but not for the box itself - when i try to telnet to port 80 (or other ports) I get "connection refused"

I would like to do 2 things:

1) Setup iptables so that going to any assigned ip on eth1 gets redirected to 192.168.0.5 ( 192.168.0.25:92 => 192.168.0.5:92 | 192.168.0.25:98 => 192.168.0.5:98 | 82.133.***.***:92 => 192.168.0.5:92 | 82.133.***.***:98 => 192.168.0.5:98) unless there is another rule pointing it elsewhere.

2) I would like the box to obey the port forwardings I have put inplace so that it can telnet to 82.133.***.*** and reach the httpd listening on 192.168.0.5
( to setup a portforwading I use the rules:

iptables -A PREROUTING -t nat -i eth1 -p tcp --dport <port> -j DNAT --to <Host IP>:<Port>
iptables -A PREROUTING -t nat -d 82.133.***.*** -p tcp --dport <port> -j DNAT --to <Host IP>:<Port>
iptables -t nat -A POSTROUTING --dst <Host IP> -p tcp --dport <port> -j SNAT --to-source 82.133.***.***
)

If you need any more information, Please ask.
 
Old 03-28-2004, 06:00 AM   #2
leckie
Member
 
Registered: Dec 2003
Location: Australia
Distribution: Mandrake 9.2
Posts: 151

Rep: Reputation: 30
why are you doing all that bull shit when u can simply use 1 nic and a hub
 
Old 03-28-2004, 10:55 AM   #3
Dataforce
Member
 
Registered: Nov 2003
Distribution: Redhat 9
Posts: 38

Original Poster
Rep: Reputation: 15
erm, maybe becuase i want to be able to actually connect to my external ip? doing it this way

a) makes my shite router give all port authority to 192.168.0.25 for me to add port forwards
b) allows me to visit http://82.133.***.*** and get something other then connection refused like i used to...

I've got it all working as i want - aprt from the box itself doesn't obey the port forwardings like i want it to....

I don't need any smart comments, this way works.
 
Old 04-02-2004, 10:41 AM   #4
Dataforce
Member
 
Registered: Nov 2003
Distribution: Redhat 9
Posts: 38

Original Poster
Rep: Reputation: 15
so i guess its not possible, Linux refuses to route connections by itself according to iptables rules...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wireless network on eth1 diabled Ethernet eth0 and eth0 never comes back tadatoshi Linux - Wireless Networking 4 09-23-2004 06:57 PM
Firewall WAN eth0 LAN eth1 self-bridges, eth0 does all routeing. Nichole_knc Linux - Networking 5 07-29-2004 03:33 PM
Routing between eth1 and eth1:1 cli_man Linux - Networking 3 04-05-2004 12:54 PM
eth1 added, mysql connections FROM this machine are from eth1. Need bound to eth0??? kreese Linux - Networking 9 03-31-2004 01:12 PM
Kernel 2.4.22 finds eth0 and eth1 but 2.6.0 does not find eth1 coollink Linux - Networking 3 01-13-2004 08:32 PM


All times are GMT -5. The time now is 05:16 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration