mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #372] Sandboxes connected to a bridge, how to connect the bridge to the Internet? #265
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#265
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jebofponderworthy on GitHub (Mar 20, 2016).
Original GitHub issue: https://github.com/netblue30/firejail/issues/372
I need this setup to run not only headless but connection-less, thus all of my sandboxes will connect to bridges, for basic example:
firejail --noprofile --net=br0 ip=10.99.99.10 bashWithin such a bash shell, I can ping other sandboxes setup with other IPs, and I can ping the host, and the host can ping the sandboxes; perfect! But when I do want to run these sandboxes connected to the outside world, I try to add the host's NIC to the bridge:
sudo brctl addbr br0 enp0s7and instead of connecting the sandboxes on br0 to the Internet, it cuts the host off from everything outside of itself! What am I missing? I have tried turning STP on, no change. I would rather not use iptables routing as some configurations have it, is there a simple 'route' statement which would do it?
@netblue30 commented on GitHub (Mar 21, 2016):
In your setup you need to move the IP address configuration from eth0 to br0 and leave eth0 unconfigured. This is a bridged setup.
I would try a routed setup, where you don't need to change your eth0 configuration: https://firejail.wordpress.com/documentation-2/basic-usage/#routed
@voidzero commented on GitHub (Mar 21, 2016):
There is also the
--defaultgwoption.@jebofponderworthy commented on GitHub (Mar 22, 2016):
Thank you both very much for writing! I created bridge br0 with subnet 10.111.111.1/24, and tried:
firejail --net=br0 --name=test --ip=10.111.111.10 --defaultgw=10.111.111.1 --dns=8.8.8.8 --dns=8.8.4.4 bashand
firejail --net=br0 --name=test --ip=10.111.111.10 --defaultgw=192.168.1.16 --dns=8.8.8.8 --dns=8.8.4.4 bashwhich both ran, but could not reach the Internet. (192.168.1.16 is the host's IP.) I also tried this:
firejail --net=br0 --name=test --ip=10.111.111.10 --defaultgw=192.168.1.1 --dns=8.8.8.8 --dns=8.8.4.4 bashbut it said "Error: default gateway 192.168.1.1 is not in the range of any network". Am I missing something simple ?
@voidzero commented on GitHub (Mar 22, 2016):
First, check the IP address and router of the host:
ip addr show dev eth0 scope globalip route show default dev eth0(you need the line that starts with "default via")Now. If my host has the IP address 192.168.0.2 and the default gateway is 192.168.0.1, start up a firejail instance as follows:
firejail --net=br0 --name=test --ip=192.168.0.3/24 --defaultgw=192.168.0.1 --dns=8.8.8.8 bashHTH
@netblue30 commented on GitHub (Mar 22, 2016):
How is your networking configured? If you reset your computer and do a /sbin/ifconfig, what does it print?
@jebofponderworthy commented on GitHub (Mar 23, 2016):
My previous testing was on a different platform; here's my primary test rig:
bnr@box-at-home:~$ sudo /sbin/ifconfigenp0s7: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.2.125 netmask 255.255.255.0 broadcast 192.168.2.255 inet6 fe80::224:21ff:fe9e:962f prefixlen 64 scopeid 0x20<link> ether 00:24:21:9e:96:2f txqueuelen 1000 (Ethernet) RX packets 549255 bytes 34082075 (32.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 17911 bytes 5171701 (4.9 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 0 (Local Loopback) RX packets 52 bytes 3120 (3.0 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 52 bytes 3120 (3.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0bnr@box-at-home:~$ sudo route -NKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface0.0.0.0 192.168.2.1 0.0.0.0 UG 100 0 0 enp0s7192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s7192.168.2.0 0.0.0.0 255.255.255.0 U 100 0 0 enp0s7bnr@box-at-home:~$The last testing I did, was this:
sudo brctl addbr br0sudo ifconfig br0 192.168.2.250/24firejail --name=SRO --noprofile --net=br0 --ip=192.168.2.252 --defaultgw=192.168.2.1 bashand the above sandbox was not able to ping or otherwise reach 8.8.8.8.
@netblue30 commented on GitHub (Mar 23, 2016):
You cannot use the same IP/network address on the bridge as you have on enp0s7.
https://firejail.wordpress.com/documentation-2/basic-usage/#routed
In your case will be:
Then, you need to set netfilter: