LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-12-2009, 11:09 AM   #1
Franxez
LQ Newbie
 
Registered: Feb 2009
Posts: 19

Rep: Reputation: 0
Routes in centos


hello, im having the some trouble config subnet routing on centos..i posted for help here last week but could not resolv the issue.

i have the fallowing

Pc1(my lan) 192.168.50.95 - gw centos
Pc2(vpn lan) 192.168.100.23
tun0< 192.168.100.0/24
centos 192.168.50.98 - gw 192.168.50.1
eth1<192.168.50.0/24

my routes

93.198.46.70 192.168.50.1 255.255.255.255 eth1 <vpn address public
192.168.100.0 None 255.255.255.0 tun0 <vpn lan
192.168.50.0 None 255.255.255.0 eth1
Default Route 192.168.50.1 eth1

i enable the ipv4 forwarding, check the firewall but pc1 wont ping pc2 but centos can. can some one help me???
 
Old 10-12-2009, 05:51 PM   #2
Franxez
LQ Newbie
 
Registered: Feb 2009
Posts: 19

Original Poster
Rep: Reputation: 0
i olso check ip tables and look fine...
 
Old 10-12-2009, 09:43 PM   #3
WorldIsNotFair
Member
 
Registered: Jun 2008
Location: Jakarta
Distribution: CentOS 5
Posts: 89

Rep: Reputation: 17
Sorry i don't clear about what you want to achieve.

You want PC1 to able access to pc2 ?
 
Old 10-13-2009, 07:41 AM   #4
Franxez
LQ Newbie
 
Registered: Feb 2009
Posts: 19

Original Poster
Rep: Reputation: 0
yes, pc1 is on my lan, centos is the vpn client y pc is in the vpn server side, so i can access using the vpn client but, i want to route those 2 subnet so other users con my lan can acces it
 
Old 10-15-2009, 12:10 PM   #5
WorldIsNotFair
Member
 
Registered: Jun 2008
Location: Jakarta
Distribution: CentOS 5
Posts: 89

Rep: Reputation: 17
you can add static route to pc2 for vpn network to lan network, the gateway can be on centos(tun0 ip)

so on pc2 ..
#route add -net 192.168.50.0/24 gw [centos tun0 ip]
 
Old 10-16-2009, 08:58 PM   #6
chrisslamar
LQ Newbie
 
Registered: Oct 2009
Posts: 5

Rep: Reputation: Disabled
[root@vpn ~]# cat makeNat
#!/bin/sh
echo 1 > /proc/sys/net/ipv4/ip_forward

/sbin/iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
/sbin/iptables -A FORWARD -i eth1 -o tun0 -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i tun0 -o eth1 -j ACCEPT

That is a script i wrote for my vpn. I think it should work reading the information you gave. You may have to change eth1 to eth0 though. Make sure to flush any IPTABLES rules that you have that deal with forwarding. Google 'iptables nat' for more info. This will bridge the networks so you can access them either way. You shouldn't have to mess with routes as the vpn server, at least OpenVPN, should create a route for you. Let me know if you have trouble.

--Chris
 
  


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
permanent static routes on CentOS/Red Hat Enterprise Linux whistl Linux - Networking 4 03-24-2009 12:30 PM
Static routes using routes/ifroutes-eth-id.. files and default gateway disabled TimtheEagle Linux - Networking 0 05-31-2008 07:08 PM
routes himyuza *BSD 6 08-03-2004 10:41 AM
I need some routes |Drakehash| Linux - Newbie 1 06-08-2003 12:22 AM
I need some routes |Drakehash| Linux - Networking 1 06-07-2003 02:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:33 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