OpenVZ Forum


Home » General » Support » *SOLVED* Source IP within VE
*SOLVED* Source IP within VE [message #7015] Fri, 29 September 2006 21:02 Go to next message
marcot is currently offline  marcot
Messages: 16
Registered: September 2006
Junior Member
Hi *,

here comes a noob question wrt. routing Smile.

Let´s say i´ve got the host running on 11.22.33.44 (first public IP), and my webserver within a VE with a public IP (second public IP).

When going through the logs or tracing packages by tcpdump all packages arriving carry the IP of my host rather than of the client requesting the webpage (somehow obvious).

However, i´d like to have the client´s IP logged within the Apache logs...

Any clue / hint on how to set up transparent routing accordingly ?

I´m using the venet device and have added the public IP as an additional IP to venet within the host environment.

Rgds,
Marco

[Updated on: Wed, 04 October 2006 06:12] by Moderator

Report message to a moderator

Re: Source IP within VE [message #7023 is a reply to message #7015] Sat, 30 September 2006 21:26 Go to previous messageGo to next message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
You need to use veth device. And bridge probably. Seek in forum and in wiki for more information.
Re: Source IP within VE [message #7027 is a reply to message #7015] Sun, 01 October 2006 00:09 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

http://wiki.openvz.org/Category:Networking might be of some help.

In case there is no recipe for your case but you will figure it out yourself -- feel free to add an article to wiki.


Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Re: Source IP within VE [message #7087 is a reply to message #7015] Tue, 03 October 2006 13:04 Go to previous messageGo to next message
John Kelly is currently offline  John Kelly
Messages: 97
Registered: May 2006
Location: Palmetto State
Member
marcot wrote on Fri, 29 September 2006 17:02

Let´s say i´ve got the host running on 11.22.33.44 (first public IP), and my webserver within a VE with a public IP (second public IP).

When going through the logs or tracing packages by tcpdump all packages arriving carry the IP of my host rather than of the client requesting the webpage (somehow obvious).

However, i´d like to have the client´s IP logged within the Apache logs...



Apache logs the client IP for me, and I don't do anything special to make it happen.


Quote:

Any clue / hint on how to set up transparent routing accordingly ?

I´m using the venet device and have added the public IP as an additional IP to venet within the host environment.



Don't do that. OpenVZ automatically publishes an ARP entry for you.



Re: Source IP within VE [message #7090 is a reply to message #7087] Tue, 03 October 2006 13:18 Go to previous messageGo to next message
marcot is currently offline  marcot
Messages: 16
Registered: September 2006
Junior Member
Hi,

thanks a lot for your reply - i did manage to get it work now (after some sleepless days/nights).

I figured out that Masquerading had still been "on", and thus the IP had obviously been SNATed Embarassed

However, veth as suggested caused issues in my recent tries, and bridging does not seem to be an option hence i have only one NIC, and bridging it to the VE would do same than just moving the NIC to the VE.

What i´m still struggling with is the fact that i do have my "main" IP within one subnet and the VE´s IPs in a different subnet.

From that perspective i´d thought about enabling FW_ALLOW_CLASS_ROUTING within my Firewall, however i just used FORWARD for all traffic heading towards and from my VE and 'firewall' it within the VE once again.

*snip*

I really thing networking as such needs some more explanation within the VZopen WIKI, even though it´s not a core topic for this page a lot of issues seem to arise from it, and some straight forward HowTo´s might save some days of "work" (like in my case).

Unfortunately i´m not that familiar with the topic, thus i´m unable to contribute here Crying or Very Sad.

I appreciate that networking configurations may differ heavily on the specific setup, however some generic stuff - like not to add the IP to anywhere within the host or questions like "shall i disable venet0 when utilizing veth ?" could be helpful.

Thanks again for your posts ! Smile

Rgds,
Marco
Re: Source IP within VE [message #7091 is a reply to message #7090] Tue, 03 October 2006 13:39 Go to previous message
John Kelly is currently offline  John Kelly
Messages: 97
Registered: May 2006
Location: Palmetto State
Member
marcot wrote on Tue, 03 October 2006 09:18

What i´m still struggling with is the fact that i do have my "main" IP within one subnet and the VE´s IPs in a different subnet.



My setup is simple. 1 HN, 2 VEs, all three IPs in the same class C. So I don't have to worry about routing, OpenVZ handles it for me, by publishing ARP entries for the VEs. The upstream router at my provider uses the ARP information, and knows to route all three IPs to my ethernet card. Then OpenVZ automatically knows how to handle packets destined for the VEs.


Quote:

From that perspective i´d thought about enabling FW_ALLOW_CLASS_ROUTING within my Firewall, however i just used FORWARD for all traffic heading towards and from my VE and 'firewall' it within the VE once again.



I don't use a firewall.

My advice is: start as simple as possible, and get that working. Then add other pieces you need, one at a time. That way, you can understand where problems begin. And maybe it will be easier to find a solution.



Previous Topic: Iptables port opening error CentOS
Next Topic: IPtraf
Goto Forum:
  


Current Time: Tue Nov 19 14:04:28 GMT 2024

Total time taken to generate the page: 0.03539 seconds