LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 05-11-2006, 10:54 AM   #16
novis
Member
 
Registered: May 2006
Posts: 59

Original Poster
Rep: Reputation: 15

... I cant try anything, im doing this at distance using ssh and someone $%·"%%$ stoped the machine, hehe. I will try it tomorrow and I will say you the results.

Thanks
 
Old 05-12-2006, 04:31 AM   #17
novis
Member
 
Registered: May 2006
Posts: 59

Original Poster
Rep: Reputation: 15
Well, finally wirks fine thanks. Some machines have problems and anothers works. I think the machines it can't connect have a hardware error, i will try to change the ethernet cards. The others works fine with the same parameters.

Thanks and Regards bathory
 
Old 05-16-2006, 10:36 AM   #18
novis
Member
 
Registered: May 2006
Posts: 59

Original Poster
Rep: Reputation: 15
New problem, the router (linux with 2 eth) cant enroute the eth1 >< eth2. Here is the rc.local archive:

!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

# Afegit per Tecnics DEIC #
modprobe ipt_MASQUERADE
modprobe iptable_filter

sleep 15
/sbin/ifconfig vmnet1:1 192.168.0.1 netmask 255.255.255.0

# No tocar pecadores xD
/sbin/ifconfig eth1 192.168.128.1 netmask 255.255.255.0 up
/sbin/ifconfig eth2 192.168.129.1 netmask 255.255.255.0 up
echo 1 > /proc/sys/net/ipv4/ip_forward
#/sbin/iptables -t nat -A POSTROUTING -s 192.168.128.0/24 -j MASQUERADE
#/sbin/iptables -t nat -A POSTROUTING -s 192.168.129.0/24 -j MASQUERADE
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/sbin/iptables -t nat -A PREROUTING -p tcp -d XXXXXXXXXXXXXX --dport 81 -j DNAT --to 192.168.128.2:80
/sbin/iptables -t nat -A PREROUTING -p tcp -d XXXXXXXXXXXXXX --dport 82 -j DNAT --to 192.168.129.2:80

Last edited by novis; 05-16-2006 at 10:38 AM.
 
Old 05-17-2006, 02:12 AM   #19
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Since I'm not expert in iptables, I suggest you to take a backup of this file, and then use a script like quicktables to create the iptables rules that fit your network. After that remove the last 3 lines of your script and add a line to run the one created by quicktables (it's name is rc.firewall by default). You can also search freshmeat to find other scripts that do the same job.
 
Old 05-17-2006, 09:08 AM   #20
dimis
LQ Newbie
 
Registered: May 2006
Posts: 20

Rep: Reputation: 0
btw.. the correct way to enable a NIC on boot is to edit your /etc/network/interfaces file.

Mine looks like this:

auto eth0
iface eth0 inet static
address 192.168.0.102
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255

auto eth1
iface eth1 inet static
address 192.168.254.102
netmask 255.255.0.0
network 192.168.254.0
broadcast 192.168.254.255
 
Old 05-17-2006, 09:44 AM   #21
novis
Member
 
Registered: May 2006
Posts: 59

Original Poster
Rep: Reputation: 15
Dimis, you're not using red hat, arent you? Because there isnt any /etc/network directory. Debian in my opinion is easier to do this things, but the $%·%%ing red hat...

Thanks for answering.
Regards

Last edited by novis; 05-17-2006 at 09:51 AM.
 
Old 05-19-2006, 04:32 AM   #22
novis
Member
 
Registered: May 2006
Posts: 59

Original Poster
Rep: Reputation: 15
Finally! The solution! Here is the rc.local archive:

!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

# Afegit per Tecnics DEIC #
modprobe ipt_MASQUERADE
modprobe iptable_filter

sleep 15
/sbin/ifconfig vmnet1:1 192.168.0.1 netmask 255.255.255.0

/sbin/ifconfig eth1 192.168.128.1 netmask 255.255.255.0 up
/sbin/ifconfig eth2 192.168.129.1 netmask 255.255.255.0 up
echo 1 > /proc/sys/net/ipv4/ip_forward
#/sbin/iptables -t nat -A POSTROUTING -s 192.168.128.0/24 -j MASQUERADE
#/sbin/iptables -t nat -A POSTROUTING -s 192.168.129.0/24 -j MASQUERADE
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/sbin/iptables -t nat -A PREROUTING -p tcp -d XXXXXXXXXX --dport 81 -j DNAT --to 192.168.128.2:80
/sbin/iptables -t nat -A PREROUTING -p rcp -d XXXXXXXXXX --dport 82 -j DNAT --to 192.168.129.2:80
/sbin/iptables -A FORWARD -i eth1 -o eth2 -p ALL -j ACCEPT
/sbin/iptables -A FORWARD -i eth2 -o eth1 -p ALL -j ACCEPT

AND!! in every pc:

route add -net 192.168.129.0 netmask 255.255.255.0 gw 192.168.128.1 dev eth1
or
route add -net 192.168.128.0 netmask 255.255.255.0 gw 192.168.129.1 dev eth1
 
  


Reply



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
cannot activate eth1 using ifup or using ifcfg-eth1 akay Linux - Hardware 10 12-16-2010 05:10 AM
Can't iniciate Windows XP through boot screen spooks Fedora - Installation 6 08-24-2004 10:23 AM
Routing between eth1 and eth1:1 cli_man Linux - Networking 3 04-05-2004 11:54 AM
eth1 added, mysql connections FROM this machine are from eth1. Need bound to eth0??? kreese Linux - Networking 9 03-31-2004 12: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 07:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:32 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration