Solvedanbox The anbox container can not connect to the network

gmg137
1038

anbox system-info:

version: local-/bin/sh: git: command not found
os:
  name: openSUSE Tumbleweed
  version: 
  snap-based: false
kernel:
  version: Linux version 4.12.8-1-default (geeko@buildhost) (gcc version 7.1.1 20170629 [gcc-7-branch revision 249772] (SUSE Linux) ) #1 SMP PREEMPT Thu Aug 17 05:30:12 UTC 2017 (4d7933a)
  binder: true
  ashmem: true
graphics:
  egl:
    vendor: Mesa Project
    version: 1.5 (DRI2)
    extensions:
      - EGL_CHROMIUM_sync_control
      - EGL_EXT_buffer_age
      - EGL_EXT_create_context_robustness
      - EGL_EXT_image_dma_buf_import
      - EGL_KHR_cl_event2
      - EGL_KHR_config_attribs
      - EGL_KHR_create_context
      - EGL_KHR_fence_sync
      - EGL_KHR_get_all_proc_addresses
      - EGL_KHR_gl_colorspace
      - EGL_KHR_gl_renderbuffer_image
      - EGL_KHR_gl_texture_2D_image
      - EGL_KHR_gl_texture_3D_image
      - EGL_KHR_gl_texture_cubemap_image
      - EGL_KHR_image
      - EGL_KHR_image_base
      - EGL_KHR_image_pixmap
      - EGL_KHR_no_config_context
      - EGL_KHR_reusable_sync
      - EGL_KHR_surfaceless_context
      - EGL_KHR_wait_sync
      - EGL_MESA_configless_context
      - EGL_MESA_drm_image
      - EGL_MESA_image_dma_buf_export
      - EGL_NOK_texture_from_pixmap
      - EGL_WL_bind_wayland_display
  gles2:
    vendor: X.Org
    vendor: OpenGL ES-CM 1.1 Mesa 17.1.6
    extensions:
      - GL_EXT_blend_minmax
      - GL_EXT_multi_draw_arrays
      - GL_EXT_texture_filter_anisotropic
      - GL_EXT_texture_lod_bias
      - GL_OES_byte_coordinates
      - GL_OES_fixed_point
      - GL_OES_stencil_wrap
      - GL_OES_compressed_paletted_texture
      - GL_OES_query_matrix
      - GL_OES_read_format
      - GL_OES_single_precision
      - GL_EXT_texture_compression_dxt1
      - GL_OES_draw_texture
      - GL_OES_point_size_array
      - GL_OES_point_sprite
      - GL_EXT_texture_format_BGRA8888
      - GL_OES_compressed_ETC1_RGB8_texture
      - GL_OES_depth24
      - GL_OES_element_index_uint
      - GL_OES_fbo_render_mipmap
      - GL_OES_framebuffer_object
      - GL_OES_mapbuffer
      - GL_OES_rgb8_rgba8
      - GL_OES_stencil8
      - GL_OES_texture_env_crossbar
      - GL_OES_texture_mirrored_repeat
      - GL_OES_texture_npot
      - GL_OES_EGL_image
      - GL_OES_packed_depth_stencil
      - GL_OES_texture_cube_map
      - GL_APPLE_texture_max_level
      - GL_EXT_discard_framebuffer
      - GL_EXT_read_format_bgra
      - GL_OES_blend_equation_separate
      - GL_OES_blend_func_separate
      - GL_OES_blend_subtract
      - GL_OES_EGL_image_external
      - GL_OES_EGL_sync
      - GL_OES_vertex_array_object
      - GL_ANGLE_texture_compression_dxt3
      - GL_ANGLE_texture_compression_dxt5
      - GL_EXT_map_buffer_range
      - GL_KHR_debug
      - GL_OES_surfaceless_context
      - GL_EXT_compressed_ETC1_RGB8_sub_texture
      - GL_EXT_polygon_offset_clamp

I use the openSUSE TumbleWeed + GNOME + 4.12.8 kernel, the installation of anbox after the application can start normally, but the anbox container can not connect to the network.

ifconfig:

anbox0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.250.1  netmask 255.255.255.0  broadcast 0.0.0.0
        inet6 fe80::bc94:4ff:fec0:3194  prefixlen 64  scopeid 0x20<link>
        ether fe:55:1d:8f:50:72  txqueuelen 1000  (Ethernet)
        RX packets 8  bytes 544 (544.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 57  bytes 10404 (10.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.2  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::4055:8b36:96f9:9c0f  prefixlen 64  scopeid 0x20<link>
        ether 40:8d:5c:78:d2:3d  txqueuelen 1000  (Ethernet)
        RX packets 1235496  bytes 1549309366 (1.4 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 727902  bytes 58273190 (55.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: 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 1000  (Local Loopback)
        RX packets 38844  bytes 444556554 (423.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 38844  bytes 444556554 (423.9 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vethEA4JQQ: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::fc55:1dff:fe8f:5072  prefixlen 64  scopeid 0x20<link>
        ether fe:55:1d:8f:50:72  txqueuelen 1000  (Ethernet)
        RX packets 8  bytes 656 (656.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 30  bytes 5582 (5.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

adb shell ifconfig:

eth0      Link encap:Ethernet  HWaddr ae:3e:ec:f8:f8:6f
          inet addr:192.168.250.2  Bcast:192.168.250.255  Mask:255.255.255.0 
          inet6 addr: fe80::ac3e:ecff:fef8:f86f/64 Scope: Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:52 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:13 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:1000 
          RX bytes:9317 TX bytes:1006 

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:65536  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:1000 
          RX bytes:800 TX bytes:800

sudo brcli show:

bridge name	bridge id		STP enabled	interfaces
anbox0		8000.fe551d8f5072	no		vethEA4JQQ

sudo systemctl status anbox-container-manager.service :

 anbox-container-manager.service - Anbox container manager
   Loaded: loaded (/usr/lib/systemd/system/anbox-container-manager.service; disabled; vendor preset: disabled)
   Active: active (running) since Fri 2017-09-01 17:21:17 CST; 12min ago
  Process: 16798 ExecStartPre=/sbin/modprobe -v -a ashmem_linux binder_linux (code=exited, status=0/SUCCESS)
 Main PID: 16829 (anbox)
    Tasks: 10 (limit: 4915)
   CGroup: /system.slice/anbox-container-manager.service
           ├─16829 anbox container-manager --data-path=/var/lib/anbox --android-image=/var/lib/anbox/android.img --privileged
           ├─16948 [lxc monitor] /var/lib/anbox/containers default
           ├─16959 /system/bin/sh /anbox-init.sh
           ├─16972 /init --second-stage
           ├─16973 /sbin/ueventd
           ├─16975 /system/bin/logd
           ├─16976 /system/bin/debuggerd
           ├─16977 /system/bin/debuggerd64
           ├─16978 /system/bin/vold --blkid_context=u:r:blkid:s0 --blkid_untrusted_context=u:r:blkid_untrusted:s0 --fsck_context=u:r:fsck:s0 --fsck_untrusted_
           ├─16984 debuggerd64:signaller
           ├─16989 debuggerd:signaller
           ├─16991 /sbin/healthd
           ├─16993 /system/bin/anboxd
           ├─16994 /system/bin/logcat -f /data/system.log -r 2048 -n 4
           ├─16995 /system/bin/lmkd
           ├─16996 /system/bin/servicemanager
           ├─16997 /system/bin/surfaceflinger
           ├─16998 zygote64
           ├─16999 zygote
           ├─17000 /system/bin/audioserver
           ├─17001 /system/bin/cameraserver
           ├─17002 /system/bin/drmserver
           ├─17003 /system/bin/installd
           ├─17004 /system/bin/keystore /data/misc/keystore
           ├─17005 media.codec mediacodec
           ├─17006 /system/bin/mediadrmserver
           ├─17007 media.extractor aextractor
           ├─17008 /system/bin/mediaserver
           ├─17009 /system/bin/netd
           ├─17010 /system/bin/fingerprintd
           ├─17011 /system/bin/gatekeeperd /data/misc/gatekeeper
           ├─17015 /system/xbin/perfprofd
           ├─17019 /system/bin/sh
           ├─17020 /sbin/adbd --root_seclabel=u:r:su:s0
           ├─17101 system_server
           ├─17183 com.android.systemui
           ├─17189 /system/bin/sdcard -u 1023 -g 1023 -m -w /data/media emulated
           ├─17246 com.android.phone
           ├─17260 com.android.settings
           ├─17350 android.ext.services
           ├─17373 org.anbox.appmgr
           ├─17400 com.android.smspush
           ├─17415 com.android.deskclock
           ├─17439 android.process.media
           ├─17471 com.android.calendar
           ├─17500 com.android.providers.calendar
           ├─17523 com.android.email
           ├─17547 com.android.managedprovisioning
           ├─17562 com.android.onetimeinitializer
           └─17583 android.process.acore

9 01 17:21:17 linux-bnry.suse anbox[16829]: You are running the container manager manually which is most likely not
9 01 17:21:17 linux-bnry.suse anbox[16829]: what you want. The container manager is normally started by systemd or
9 01 17:21:17 linux-bnry.suse anbox[16829]: another init system. If you still want to run the container-manager
9 01 17:21:17 linux-bnry.suse anbox[16829]: you can get rid of this warning by starting with the --daemon option.
9 01 17:21:17 linux-bnry.suse anbox[16829]: 
9 01 17:21:17 linux-bnry.suse anbox[16829]: Everything setup. Waiting for incoming connections.
9 01 17:21:39 linux-bnry.suse anbox[16829]: Got connection from pid 16928
9 01 17:21:39 linux-bnry.suse anbox[16829]: Containers are stored in /var/lib/anbox/containers
9 01 17:21:39 linux-bnry.suse anbox[16829]: Using rootfs path /var/lib/anbox/rootfs
9 01 17:21:39 linux-bnry.suse anbox[16829]: Container successfully started

sudo systemctl status anbox-bridge.service :

 anbox-bridge.service - Anbox network bridge
   Loaded: loaded (/usr/lib/systemd/system/anbox-bridge.service; enabled; vendor preset: enabled)
   Active: active (exited) since Fri 2017-09-01 17:21:17 CST; 13min ago
  Process: 16797 ExecStart=/usr/lib/anbox/anbox-bridge.sh start (code=exited, status=0/SUCCESS)
 Main PID: 16797 (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 4915)
   CGroup: /system.slice/anbox-bridge.service

9 01 17:21:17 linux-bnry.suse systemd[1]: Starting Anbox network bridge...
9 01 17:21:17 linux-bnry.suse systemd[1]: Started Anbox network bridge.
52 Answers

✔️Accepted Answer

Running the following commands made my network work in Anbox, running Ubuntu 17.10:

adb shell
su
ip route add default dev eth0 via 192.168.250.1
ip rule add pref 32766 table main
ip rule add pref 32767 table local

Other Answers:

If you adb shell into the Anbox container, you can see that not only is the default gateway missing, but the default routing policies are somehow missing too.

x86_64:/ # ip route
192.168.250.0/24 dev eth0  proto kernel  scope link  src 192.168.250.2 
x86_64:/ # ip rule
0:      from all lookup local 
10000:  from all fwmark 0xc0000/0xd0000 lookup 99 
13000:  from all fwmark 0x10063/0x1ffff lookup 97 
13000:  from all fwmark 0x10064/0x1ffff lookup 1055 
15000:  from all fwmark 0x0/0x10000 lookup 99 
16000:  from all fwmark 0x0/0x10000 lookup 98 
17000:  from all fwmark 0x0/0x10000 lookup 97 

This can be manually fixed (either as root inside the container, or using ip -netns from outside).

x86_64:/ # ip route add default dev eth0 via 192.168.250.1
x86_64:/ # ip rule add pref 32766 table main
x86_64:/ # ip rule add pref 32767 table local                                  

I don't understand how it would have ended up in this state, though.

Related Issues:

41
anbox The anbox container can not connect to the network
Running the following commands made my network work in Anbox running Ubuntu 17.10: ...
30
anbox No sound and videos not playing in iTube and browser
Simple to execute This solution worked for me. Please check that no similar bug is already reported ...
12
anbox Root permission for apps
Another try Got play store starting but as there is no network connection (another problem #51) it's...
10
anbox Difficult to install on Fedora system
dnf config-manager --add-repo=http://download.opensuse.org/repositories/home:/gasinvein:/anbox/Fedor...
750
react native keychain SDK Build Tools revision (23.0.1) is too low for project :react-native-keychain.
Ok I found a solution to this For people facing the same problem in the future Hey there ...
748
material components android Manifest merger failed : Attribute application@appComponentFactory
I had similar problem We're transitioning from github issues to a public buganizer component Rather ...
746
expo Error: fsevents unavailable (this watcher can only be used on Darwin)
Possible solution: I had installed watchman via npm install -g watchman but apparently this installs...
459
flutter Multiple commands produce '/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework
I was able to fix it by opening the Runner workspace project in Xcode 10 Then navigate to File ...
449
flutter App Store iOS submission fails: The bundle Runner.app/Frameworks/App.framework does not support the minimum OS Version specified in the Info.plist
After doing a flutter clean changing MinimumOSVersion (inside /ios/Flutter/AppframeworkInfo.plist) t...
418
flutter 'com.android.support:appcompat-v7' has different version for the compile (26.1.0) and runtime (27.0.1) classpath
is like this i receive an error when i run flutter run My gradle.build file is: flutter doctor: ...
409
flutter Why does my text not wrap?
You have to wrap Column in a flexible Without flexible the column's width is not constrained to the ...
383
flutter Unexpected top padding in ListView put inside scaffold with no appBar
Yeah this is intentional If you put a widget before the ListView you should wrap the ListView with a...
315
flutter Missing xcode dependency: Python module "six"
try python2.x -m pip install six by @humblerookie's suggest or brew reinstall python@2 pip install s...
306
expo exp build:android fails
This works exp start Cancel ctrl c then do exp build:android. Running exp build:android errors fails...
285
flutter flutter messaging: set the notification icon
Hey guys I fought with this for the better part of a day For some strange reason there are no tutori...
281
flutter Issue with cloud_firestore - Cannot fit requested classes in a single dex file.
As a workaround you can try enabling mutlidex for Android App by following Enable multidex for apps ...
265
flutter D8: Program type already present: io.flutter.BuildConfig
@smrucv I received the same error but after flutter clean and flutter packages get everything works ...
250
238
flutter Introduction of characters package causes crash on flutter run for preexisting Flutter applications
In my case I resolved the issue with flutter clean After e0ed12c I get this error when building: @ju...
222
nativescript cli TNS doctor doesn't recognize Xcode (High Sierra)
HI @philipfeldmann Can yhou please run xcodebuild -version and paste the output? May be Xcode is ins...
221
flutter Making Network http error SocketException: Failed host lookup
@hoc081098 Double-check / make sure you have <uses-permission android:name=android.permission.INTERN...
216
flutter Support inlining Android/iOS views
iOS view embedding support has landed on master This is still just a preview There are multiple open...
207
flutter ✗ Android license status unknown.
Hi everyone Steps to Reproduce Please tell us what you were doing and what went wrong If you are run...
195
react native mapbox gl No static method toHumanReadableAscii
here is workaround: build.gradle got the following error on runtime: java.lang.NoSuchMethodError: No...
185
flutter idevice_id cannot run on catalina
When you're developing on Catalina Steps to Reproduce Run flutter doctor on macOS Catalina I get the...
181
flutter type 'List<dynamic>' is not a subtype of type 'List<String>'
The problem is your fromMap constructor is reading from a Map<String dynamic> ...
178
flutter TextField is hidden by keyboard inside of a Modal Bottom Sheet
This may not work for all situations but I have a modalBottomSheet that contains only a TextField ...
173
retrofit Kotlin & @Body
You can still use Map just suppress its wildcardness with @JvmSuppressWildcards ...
169
NativeBase Needs to tap twice to fire onPress function when keyboard is open
@bm-software Use keyboardShouldPersistTaps={'handled'} and will works fine. react-native ...
162
react native firebase 🔥(Android) Program type already present: io.invertase.firebase.BuildConfig
I think I found my ultimate error here In my package.json file I had at some point earlier ...
160
flutter Dismissing keyboard programatically
This is a better way as it also clears the focus: FocusScope.of(context).requestFocus(new FocusNode(...
157
flutter How to solve: Android license status unknown and also Android sdkmanager tool not found? Tried everything(as i think)
The answer is here Uncheck Hide Obsolete Packages and you'll see Android SDK Tools (Obsolete) 26.1.1...
156
flutter MissingPluginException: No implementation found for method
@mravn-google Yeah turned out I had to quit the flutter run process and start it up again Just a ful...
156
flutter firebase_auth: ^0.8.0+1 crashes on Android
Here i put this in file: android/gradle.properties: and changed targetSdkVersion to 28 and it worked...
156
react native modal The statusbar turns white when the modal is open (only on certain devices)
statusBarTranslucent property has been added to Modal of RN 0.62 I think this problem has been solve...
153
flutter Android sdkmanager tool not found (C:...\Local\Android\sdk\tools\bin\sdkmanager)
This worked for me: open Android Studio's SDK Manager go to the Android SDK tab under SDK Tools ...
149
flutter 1.22.2 - Flutter plugin not installed; this adds Flutter specific functionality.
Hey @bhanuka96 try this line of code How do I fix this android plugin error? This error is being com...
145
cli pod install failure with glog
what helped me: sudo xcode-select --switch /Applications/Xcode.app Ask your Question I have been try...
144
create react native app issue running on ubuntu 16.04 (watchman)
I got it working by running: OS Info: Run: Output: ...
139
flutter [ios][release] GeneratedPluginRegistrant.m Module not found
I may have found the answer from this comment: #21989 (comment) Seems like by opening up the project...
137
flutter [App.framework] Linked and embedded framework 'App.framework' was built for iOS/iOS Simulator
Does rm -rf ios/Flutter/App.framework get you unstuck? SOLUTION @jmagman has written an article on h...
137
Xposed Let's port Xposed to N
Surprisingly by porting M changes to N everything works well From my experience I can tell you that ...
134
flutter Bad state: Future already completed
I had the same issue.. The problem was the same that @soaresgabriel said but I was not navigating di...
131
create react native app AwesomeProject@0.1.0 start: react-native-scripts start- ERR! Exit status 1
As suggested at the error message installing watchman solved this error for me (OSX 10.9.5) ...
129
flutter Execution failed for task ':app:compileFlutterBuildDebug' Issue
Hi @Ramihtet your logs show a different flutter version; could you please run flutter channel stable...
126
capacitor FileReader API not firing
You can try this. Description of the problem: In my project I'm trying to read and convert a Blob do...
124
flutter Unable to load Asset - wrong indentation in pubspec.yaml
Is your assets key underneath a flutter: key as well? https://flutter.io/assets-and-images/ ...