OpenVZ Forum


Home » General » Support » [Answered] How to allocate ip addresses from ISP via DHCP .....
[Answered] How to allocate ip addresses from ISP via DHCP ..... [message #34769] Mon, 02 February 2009 08:26 Go to next message
schjeall is currently offline  schjeall
Messages: 27
Registered: February 2009
Location: Denmark
Junior Member
My ISP gives away 5 ip-adresses and they are allocated when a device is requesting a new IP-address (with a diffrent MAC).

Now, how do I get each CT1..5 firing DCHP requests at my ISP's network? I think it's a routing/firewall problem at CT0. I use easy-mac.sh to generate individual MAC addresses.


ISP network 
   |
----------
|  DSL   |
----------
    |
    |
   eth0
   |  \
   |   \ DCHP requests
   |    \
------- --------
| CT0 | |CT1..5|
------- --------

CT0, connects perfectly to the internet.

Please, can someone provide me with a command-walkthrough? Also, what is most handy to use veth og venet?

[Updated on: Wed, 04 February 2009 19:53]

Report message to a moderator

Re: How to allocate ip addresses from ISP via DHCP ..... [message #34774 is a reply to message #34769] Mon, 02 February 2009 12:36 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Hello,

Quote:


Also, what is most handy to use veth og venet?



There is a wiki page. It might be helpful.
http://wiki.openvz.org/Differences_between_venet_and_veth

And I didn't catch your idea fully. What's your problem? Anyway, I found another wiki page
http://wiki.openvz.org/DHCP
Re: How to allocate ip addresses from ISP via DHCP ..... [message #34793 is a reply to message #34774] Tue, 03 February 2009 07:32 Go to previous messageGo to next message
schjeall is currently offline  schjeall
Messages: 27
Registered: February 2009
Location: Denmark
Junior Member
Hello

I basically want to allocate IP addresses for CT1..5 via a DHCP server sitting on the network.

I have followed this HOW-TO (section "DHCP supplied addresses").

http://wiki.openvz.org/Common_Networking_HOWTOs

CT1 is not getting any lease from the DHCP server. I have set everything up according to the HOW-TO and Quick Install - I have even stopped IPTABLES.

Do you have a suggestion about what to do next?
Re: How to allocate ip addresses from ISP via DHCP ..... [message #34798 is a reply to message #34793] Tue, 03 February 2009 08:45 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Hello,

you don't have to generate MAC addresses with easy-mac.sh script because vzctl should generate them automatically.

The following scenario should work (it's a compilation from wiki page http://wiki.openvz.org/Veth )

(on the HN)
# brctl addbr br0
# brctl addif br0 eth0
# vzctl set $VEID --netif_add eth0 --save
# brctl addif br0 veth$VEID.0
# ifconfig eth0 0
# ifconfig veth$VEID.0 0
# echo 1 > /proc/sys/net/ipv4/conf/veth$VEID.0/forwarding
# echo 1 > /proc/sys/net/ipv4/conf/veth$VEID.0/proxy_arp
# echo 1 > /proc/sys/net/ipv4/conf/eth0/forwarding
# echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp
# ifconfig br0 0
# echo 1 > /proc/sys/net/ipv4/conf/br0/forwarding
# echo 1 > /proc/sys/net/ipv4/conf/br0/proxy_arp
# dhclient br0

Then ip address should appear on br0 interface and then

(inside CT)
# dhclient eth0


If this scenario doesn't work then:
- use tcpdump utility on the HN and inside the container when dhclient is running inside CT
- make sure that you don't have to register MAC addresses inside your CTs because of your network policy rules.
icon14.gif  Re: How to allocate ip addresses from ISP via DHCP ..... [message #34804 is a reply to message #34798] Tue, 03 February 2009 21:43 Go to previous message
schjeall is currently offline  schjeall
Messages: 27
Registered: February 2009
Location: Denmark
Junior Member
Hello

I love Linux, I love OpenVZ and I almost love you! Smile

Thanks you so much for your help!

I got everything working after following your instructions - I just needed to add a default route to my gateway:

CT101#route add default gw 192.168.1.1 dev eth0


Previous Topic: [solved] /proc/self/loginuid missing on HN on el5.028stab060.2 causing auditd to fail?
Next Topic: 2 Digit IDs - Updated
Goto Forum:
  


Current Time: Wed Aug 14 03:20:08 GMT 2024

Total time taken to generate the page: 0.02839 seconds