Can't Access Internet From Instance

Bug #1812415 reported by Pen Gale
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
MicroStack
New
High
Pen Gale

Bug Description

Currently, we don't actually attempt to connect the virtual networks created by Openstack to the outside world. This means that you can't access the Internet from created instances.

The instructions at https://docs.openstack.org/mitaka/networking-guide/intro-nat.html should get you started if you want to setup Internet Access manually.

This bug will be closed when the snap sets up Internet access automagically. (Setting up SNAT is probably the best solution, as that involves the lightest touch on the host system.)

Pen Gale (pengale)
Changed in microstack:
importance: Undecided → High
status: New → Confirmed
James Page (james-page)
Changed in microstack:
status: Confirmed → Triaged
Pen Gale (pengale)
Changed in microstack:
milestone: none → microstack19.10
no longer affects: microstack/19.10
Revision history for this message
Pen Gale (pengale) wrote :

We have a fix for this! Big hat tip to admcleod and james-page for figuring this out.

On the host system, you need to setup some iptables rules, and run a sysctl command:

sudo iptables -t nat -A POSTROUTING -s 10.20.20.1/24 ! -d 10.20.20.1/24 -j MASQUERADE
sudo sysctl net.ipv4.ip_forward=1

The iptables rules are trivial to add. The ip_forward thing is a bit trickier, because I don't want to leave a mess on people's systems. If you snap install lxd, then do lxd init, then snap remove lxd, you'll have that rule set for you, however, so microstack wouldn't be unique in setting the rule.

I'm a little tempted to add a "microstack.configure" command. Or "microstack init". That would give the user a bit more warning that they might be writing some configuration to their system outside the snap. And it would get around our timeout issues w/ mysql. Hmmm ...

Revision history for this message
Pen Gale (pengale) wrote :
Changed in microstack:
assignee: nobody → Pete Vander Giessen (petevg)
status: Triaged → In Progress
status: In Progress → Fix Committed
Revision history for this message
Pen Gale (pengale) wrote :

Code merged, and a snap release is making its way to the edge channel.

Revision history for this message
Pen Gale (pengale) wrote :

The fix is now on both the edge and beta channels!

Changed in microstack:
status: Fix Committed → Fix Released
Revision history for this message
Dalton Cézane (daltoncezane) wrote :

I created an instance with Ubuntu Bionic and I cannot access the Internet.
microstack.openstack server list
+--------------------------------------+------+--------+------------------------------------+---------------+----------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+------+--------+------------------------------------+---------------+----------+
| 45973844-4f54-406a-9098-7560da5fdb69 | osm | ACTIVE | test=192.168.222.196, 10.20.20.193 | ubuntu_bionic | m1.large |
+--------------------------------------+------+--------+------------------------------------+---------------+----------+

Revision history for this message
ramy (rdawoud) wrote :

it worked with me after i added
 sudo sysctl net.ipv4.ip_forward=1
to the host machine

Revision history for this message
Pen Gale (pengale) wrote :

This bug is no longer fixed in the current release of microstack, due to changes made in preparation for a confined snap. I’m not sure how you’d get microstack to automatically add the ip forwarding rules in a confined environment, though.

Changed in microstack:
status: Fix Released → New
Revision history for this message
Nicolas Ferrario (nferrario) wrote :

Yup, had same issue here and fixed it with sudo sysctl net.ipv4.ip_forward=1. It'd be great for this to be documented at least.

Revision history for this message
Sasank (sasankchilamkurthy) wrote :

It didn't work for me even with `sudo sysctl net.ipv4.ip_forward=1` :(

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.