Skip to content

Commit e6f2155

Browse files
authored
Update README.md
1 parent 83feba5 commit e6f2155

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,49 @@ this will launch wget with default gateway set to `192.168.2.1` and default name
1717
Compilation instructions are inside the sources.
1818
OpenWrt package makefile included.
1919

20+
# Force an application to use a specific network interface
21+
22+
We need to find what gateway the network interface is using then force that gateway to our jailed application
23+
24+
- Find the interface gateway (there are many solution to find the gateway here are some command that permit to find the used gateway)
25+
26+
```
27+
$ route
28+
$ route -n
29+
$ ip rule list
30+
$ ip route show
31+
$ netstat -rn
32+
$ cat /etc/network/interfaces
33+
$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
34+
$ traceroute www.google.com
35+
$ ip route show 0.0.0.0/0 dev eth0
36+
```
37+
2038
# Per application gateway
2139

40+
- Build Approute-Utils
41+
42+
```
43+
git clone https://github.com/Intika-Linux-Network/Approute-Utils.git
44+
cd Approute-Utils
45+
chown 755 make.sh
46+
./make.sh
47+
```
48+
- Add a route for the future marked packets (will belong to the jailed application) in the example `192.168.1.1` is used as the forced gateway, those routes wont affect other applications, this manipulation have to be done only once at the system boot for instance
49+
50+
```
51+
ip rule add fwmark 10 table 100
52+
ip route add default via 192.168.1.1 table 100
53+
```
54+
55+
- Start the application that you want to jail
56+
57+
```
58+
MARK=10 LD_PRELOAD=./mark.so firefox
59+
```
60+
61+
- Testing the wan ip address
2262

63+
```
64+
MARK=10 LD_PRELOAD=./mark.so wget -qO- ifconfig.me
65+
```

0 commit comments

Comments
 (0)