Questions tagged [iptables]
The iptables tag has no usage guidance.
36 questions
0
votes
0
answers
65
views
Firewall on an Android hotspot
So my idea for a project is a firewall for Android hotspot. Like on routers you can block access to certain websites, I want to implement it in Android. In settings, system can only limit number of ...
0
votes
0
answers
58
views
veth peer with netns in android
How I can create veth with netns in android, with internet connection.
What I try:
sudo ip netns add client
sudo ip link add veth0 type veth peer name veth1
sudo ip link set veth1 netns client
sudo ip ...
0
votes
0
answers
65
views
iptables for route all packet except some process
My tailscaled magisk module run in userspace mode, in order to proxy traffict to localsocks5 on port 1099 I'm using hev-socks5-tunnel.
Using iptables to mark packet the connection going to 100.64.0.0/...
0
votes
0
answers
36
views
Does Android support SNAT/DNAT on iptables?
Does Android support DNAT/SNAT target on iptables ? Is there another alternative for doing port forwarding ?
0
votes
1
answer
320
views
Adding iptables extensions
After a huge hustle I managed to compile the xt_DSCP.ko kernel module and it can be loaded with no errors.
:/ $ su
:/ # insmod /sdcard/xt_DSCP.ko
:/ #
I also managed to pull iptables external from ...
-1
votes
1
answer
736
views
Access iptables logs on Android
I'm attempting to diagnose a packet forwarding issue on my Android 9 phone. I've added a -j LOG rule to my FORWARD chain. How can I access the logged messages?
According to this guide, I first need ...
2
votes
0
answers
230
views
Why is the 'iptables' target 'NFLOG" not sending log messages to the Kernel?
I recently started using an old cell phone, Samsung Galaxy J7 model SM-J700M. I rooted it, flashed LineageOS and installed a SIM card and it works just fine. I decided to work on a script with ...
0
votes
1
answer
203
views
How to modify the IP packet destination IP address in Android?
Here, I can type this in Termux
su
iptables -I OUTPUT -d 1.2.3.4 -j REJECT
iptables-save
to reject the packet so as to forbid the Application to visit a certain host. It works well.
However, now I ...
1
vote
0
answers
135
views
Opening iptables for initial Android setup blocks connectivity
I installed an AOSP Android 12 based ROM with root. I set up a simple custom stateful iptables firewall to block all connectivity except for a browser. I connect to WiFi and there is no internet. This ...
1
vote
0
answers
40
views
Route mobile hotspot traffic through VPN on a rooted device [duplicate]
I'm running an unlocked and rooted Samsung Galaxy Note 20 Ultra 5G (SM-N986U1) with an Android 12 custom ROM on the most recent security patch. The goal is that any devices that connect to my mobile ...
0
votes
0
answers
234
views
How to route all my Android phone own's DNS request to 8.8.8.8 in iptables with root?
su
iptables -t nat -I OUTPUT -p udp --dport 53 -j DNAT --to 8.8.8.8:53
The above command is really working, but only for client phones who are using my phone's WiFi hotspot.
The result I need is for ...
2
votes
0
answers
1k
views
How to IP forwarding/NAT from WIFI -> Mobile data without creating hotspot/access point
I would like to be able to use my android phone as a backup internet connection if my home broadband goes down.
The idea is that if the network went down I would set up a static route on my home ...
0
votes
0
answers
252
views
How to override (or a least view) the RDNSS ipv6 DNS? (root)
As far as ipv4 DNS is concerned, Android (at least version 9) can override default DNS settings fairly well.
Firstly, it is possible to set net.dns* to the desired value.
Secondly, iptables -t nat ...
3
votes
2
answers
1k
views
How to run .sh script (iptables commands) on start up
I am using LineageOS 18.1
When I was on LOS 16, I used to edit the file /system/etc/init.d/00banner and put my iptables commands there, e.g.:
#!/system/bin/sh
sh -c 'iptables -A OUTPUT -m owner --uid-...
2
votes
0
answers
509
views
iptables-restore not working after iptables-save
I am trying the below
with iptables-save > test.rules i am saving the saved rules file
then with command iptables-restore test.rules, i am trying to restore the rules
On iptables-restore, seeing ...
1
vote
1
answer
2k
views
Android: how to find application locking xtables?
I have Pixel Experience (Android 10) installed on my Redmi K20. + Magisk 21.4.
In terminal I enter command iptables -t mangle -L -n | grep TTL which throws Another app is currently holding the xtables ...
1
vote
1
answer
875
views
Android cannot forward packets
Target:
Perform IP forwarding for devices within the same local network. (The real target is transparent proxy but the IP forwarding is a prerequisite)
Network setup:
All devices are in the same local ...
0
votes
0
answers
41
views
Is it possible to change the userID of something like Fused Location Provider?
I have a bunch of apps bundled under userID on my stock rom, including Fused Location Provider. Since I'm using AFWall+ to block said userID to block said apps - it also breaks my location detection ...
2
votes
0
answers
195
views
How can I bypass android 9 VPN with iptables?
I'm targeting specific app with UID rule -m owner --uid-owner 1337 and I want this app always bypass VPN and use direct Wi-fi/Mobile Data connection. Ideally, I also want it to be universal, if ...
4
votes
2
answers
19k
views
How to send all internet traffic to a SOCKS5 proxy server in local network?
I got the inspiration here. It looks like AFWall+ is able to create a NAT forwarding policy to keep all traffic going through a SOCKS5 proxy and fool Google apps into thinking they are not connected ...
0
votes
0
answers
1k
views
AFWall+ not blocking consistently
I'm running a rooted pixel 3 (Magisk) with the "liboemcrypt disabler" module for running Netflix, Magisk Hide and the dg.db edit to disable attestation for running Google Pay.
The firewall will work ...
2
votes
1
answer
2k
views
Restricting an app to only send internet traffic but not receive that back?
Is there a way or app to restrict some apps on my Android, or the whole device, to only send internet data packets but not receive them back?
I want to confuse a game app by doing this. It restricts ...
1
vote
0
answers
220
views
Cannot connect to Wifi iptables error
Lately my Google Pixel 2 will not connect to my Homewifi.
It tries to connect all the time. Looking into the Log I get an iptables error:
05-06 10:03:56.253 1120-1355/? D/RecurrenceRule: Resolving ...
2
votes
1
answer
1k
views
Android DHCP Port Redirection
I am working on a MirrorLink implementation for the Google Pixel (Android 8.1.0). I must implement a DHCP server; however, Android applications cannot listen on reserved ports.
The Android ...
1
vote
0
answers
459
views
How to keep iptables changes on android after reboot?
If I do any changes to iptables on Android (my phone is running CyanogenMod 11 -
Android 4.4.3), then these changes are lost after phone reboot.
What should I do to keep them saved?
1
vote
0
answers
960
views
Where should I place iptables update on Android at boot time?
I need to write specific values in the routing system using the iptables command for Android.
The overall idea is that the user can navigate only using the provided DNS configuration.
I've tried to ...
1
vote
0
answers
543
views
Android VPN service's policy based routing relative to iptables (specific behavior question, android 5.0, 5.1)
Background:
Several phones, different firmwares
Elephone p7000, Android 5.0 based rom
Xiaomi redmi note 2, three different roms (5.1 based Cyaonogen, 5.0 based AOSP derivative)
Rooted.
Installed a ...
1
vote
0
answers
2k
views
Configuring Android to IP FORWARDING
Android version : Lollipop. Rooted: Yes.
I'm trying to connect a PC to a Laptop via a WLAN.
I'm using my android as a WifiAdapter. I connected the android node to the WLAN. With a USB cable ...
1
vote
0
answers
627
views
reverse tethering - offline for some applications
I try to get internet on my phone from my computer without instlling any tools.
My configuration looks like :
mybox -----(Ethernet)------[my computer]------(USB)-----[the phone]
I enabled usb ...
2
votes
0
answers
1k
views
How to Reverse Usb Tethering with VPN [tun0 interface] routing?
I have a big problem and after many days I can't find any solution because I'm not Linux experienced user...
Problem: I'm using USB [Reverse] Tether (Windows share internet with android phone via USB ...
1
vote
1
answer
353
views
Forward tethered device?
Alright, so I have a raspberry pi (192.168.42.53 on rndis0) that is tethered to an android tablet to access the internet. The tablet is connected to my home LAN via WiFi (on wlan0). How do I forward ...
2
votes
1
answer
8k
views
How to enable IP forwarding in Android?
In Linux, we can
# echo 1 > /proc/sys/net/ipv4/ip_forward
or
# sysctl -w net.ipv4.ip_forward=1
There is no sysctl command nor /proc/sys/net/ipv4/ip_forward file in Android.
Is there an equivalent ...
1
vote
2
answers
2k
views
App that survives a factory reset
My problem is theoretical at this moment. I am investigating if it is possible or not, before spending hours on it.
I have a rooted phone.
I want to add an entry to the IPTABLES on startup.
If the ...
3
votes
1
answer
15k
views
How can I add iptables rules that persist across reboots?
I want to add an iptables rule on my Android phone. I used:
iptables -t nat -A PREROUTING -p 6 -d 192.168.66.1 --dport 80 -j DNAT --to 192.168.66.1:808
...as root. This rule can be checked in adb ...
2
votes
2
answers
15k
views
DNAT iptables rule on rooted Android phone?
How i can set iptables rule like this on my rooted Android phone:
iptables -t nat -A PREROUTING -i wlan0 -s 192.168.1.100 -p tcp --dport 80 -j DNAT -–to-destination 192.168.1.101:8080
... since ...
0
votes
1
answer
437
views
How can I debug Droidwall blocking every app?
Starting some time ago, I have noticed that when Droidwall (1.5.7) is enabled, no apps can access wifi.
Although the app is checked, it doesn't work, until I turn the firewall completely off. This ...