I recently ran across a similar situation where I could not access the 
container behind a firewall.

This is how I got around that:

My host configuration:
##############################
xxxx@lxc3100:~# ifconfig
br0       Link encap:Ethernet  HWaddr 00:26:18:81:1e:7d
           inet addr:172.31.32.100  Bcast:172.31.255.255 Mask:255.255.0.0
           inet6 addr: fe80::226:18ff:fe81:1e7d/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:5957760 errors:0 dropped:0 overruns:0 frame:0
           TX packets:3716467 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:10228096239 (10.2 GB)  TX bytes:277123308 (277.1 MB)

br1       Link encap:Ethernet  HWaddr 00:0e:0c:85:da:85
           inet addr:192.168.2.100  Bcast:192.168.2.255 Mask:255.255.255.0
           inet6 addr: fe80::20e:cff:fe85:da85/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:26142 errors:0 dropped:0 overruns:0 frame:0
           TX packets:994 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:2353115 (2.3 MB)  TX bytes:85436 (85.4 KB)

eth0      Link encap:Ethernet  HWaddr 00:26:18:81:1e:7d
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:7079456 errors:0 dropped:0 overruns:0 frame:0
           TX packets:3899570 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:10396462129 (10.3 GB)  TX bytes:425272196 (425.2 MB)
           Interrupt:42 Base address:0x2000

eth1      Link encap:Ethernet  HWaddr 00:0e:0c:85:da:85
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:40970 errors:0 dropped:0 overruns:0 frame:0
           TX packets:4890 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:4198163 (4.1 MB)  TX bytes:409130 (409.1 KB)

lo        Link encap:Local Loopback
           inet addr:127.0.0.1  Mask:255.0.0.0
           inet6 addr: ::1/128 Scope:Host
           UP LOOPBACK RUNNING  MTU:16436  Metric:1
           RX packets:19 errors:0 dropped:0 overruns:0 frame:0
           TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:1572 (1.5 KB)  TX bytes:1572 (1.5 KB)

lxcbr0    Link encap:Ethernet  HWaddr 52:45:5f:77:8e:5c
           inet addr:10.0.3.1  Bcast:10.0.3.255  Mask:255.255.255.0
           inet6 addr: fe80::98a6:cbff:fef9:ced3/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:3643193 errors:0 dropped:0 overruns:0 frame:0
           TX packets:6874148 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:216300770 (216.3 MB)  TX bytes:10328729114 (10.3 GB)

##############################
My container configuration:

xxxx@ubumirror3101:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 62:c3:08:bc:de:7d
           inet addr:10.0.3.224  Bcast:10.0.3.255  Mask:255.255.255.0
           inet6 addr: fe80::60c3:8ff:febc:de7d/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:258 errors:0 dropped:0 overruns:0 frame:0
           TX packets:374 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:20981 (20.9 KB)  TX bytes:34366 (34.3 KB)

eth1      Link encap:Ethernet  HWaddr e6:f6:c5:e0:30:4d
           inet addr:172.31.30.101  Bcast:172.31.255.255 Mask:255.255.0.0
           inet6 addr: fe80::e4f6:c5ff:fee0:304d/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:1747 errors:0 dropped:0 overruns:0 frame:0
           TX packets:555 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:176521 (176.5 KB)  TX bytes:69446 (69.4 KB)

eth2      Link encap:Ethernet  HWaddr 46:59:45:fa:67:11
           inet addr:192.168.2.101  Bcast:192.168.2.255 Mask:255.255.255.0
           inet6 addr: fe80::4459:45ff:fefa:6711/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:1454 errors:0 dropped:0 overruns:0 frame:0
           TX packets:311 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:130089 (130.0 KB)  TX bytes:27156 (27.1 KB)

lo        Link encap:Local Loopback
           inet addr:127.0.0.1  Mask:255.0.0.0
           inet6 addr: ::1/128 Scope:Host
           UP LOOPBACK RUNNING  MTU:16436  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
##############################
A small bash shell script to create a new route and survive after reboots:

#!/bin/bash
# File: container_gateway-sh
#---------------------------------------
gateway_setup ()
{
if [[ ! -e  /etc/init.d/rkgateway ]]
then
cat <<EOF > /etc/init.d/rkgateway
         #!/bin/sh -e
         # File: /etc/init.d/rkgateway
         route add default gateway 192.168.2.1
         wait
         EOF
wait
chmod +x /etc/init.d/rkgateway; wait
update-rc.d rkgateway defaults 98 02; wait
fi
}
# to remove
# update-rc.d -f rkgateway remove
#
gateway_setup
##################################

Ron Kaluta

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Lxc-users mailing list
Lxc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-users

Reply via email to