Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] stop network on TAP device
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3943
Location: Hamburg

PostPosted: Sun Aug 04, 2013 9:34 pm    Post subject: [solved] stop network on TAP device Reply with quote

I'm playing here with running 2 user mode linux images a the same time. Each UML gets its DHCP address from the host. Now I'd like to suddenly break the network from /to 1 of both images. I'd thinking to do that with iptables. Anybody knows a working solution ? I'm already running an iptables script located in /etc/init.d and b/c rules are just added at the end of I'd like to avoid cleaning the tables it by restarting the init.d script. Instead I just like to revert the particular rule which can be used to stop the network traffic.

Last edited by toralf on Mon Aug 05, 2013 5:45 pm; edited 1 time in total
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Mon Aug 05, 2013 6:35 am    Post subject: Reply with quote

iptables -t tablename -D (rest of command would match the rest of the -A command that created it)

This is in general how you remove a rule from iptables manually.

Like, let's say my iptables-save looks like:
Code:
# Generated by iptables-save v1.4.13 on Mon Aug  5 01:33:47 2013
*filter
:INPUT ACCEPT [8191684:9297331274]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [6192315:606443488]
-A FORWARD -s 192.168.0.0/16 -i eth0 -j ACCEPT
-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
-A FORWARD -d 192.168.0.0/16 -i ppp0 -j ACCEPT
-A FORWARD -s 192.168.0.0/16 -i eth2 -j ACCEPT
-A FORWARD -d 192.168.0.0/16 -i eth2 -j ACCEPT
COMMIT
# Completed on Mon Aug  5 01:33:47 2013
# Generated by iptables-save v1.4.13 on Mon Aug  5 01:33:47 2013
*nat
:PREROUTING ACCEPT [2690134:845364370]
:INPUT ACCEPT [164830:39214556]
:OUTPUT ACCEPT [203937:13325685]
:POSTROUTING ACCEPT [203784:13316196]
-A POSTROUTING -o ppp0 -j MASQUERADE
-A POSTROUTING -o eth2 -j MASQUERADE
COMMIT
# Completed on Mon Aug  5 01:33:47 2013


and I want to get rid of "-A FORWARD -d 192.168.0.0/16 -i ppp0 -j ACCEPT"

This takes...

iptables -t filter -D FORWARD -d 192.168.0.0/16 -i ppp0 -j ACCEPT
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3943
Location: Hamburg

PostPosted: Mon Aug 05, 2013 1:56 pm    Post subject: Reply with quote

BradN wrote:
iptables -t tablename -D (rest of command would match the rest of the -A command that created it)

This is in general how you remove a rule from iptables manually.
Ah - this helps me.
Thanks for your examples.

UpdateBut now I'm realizing that one of my first iptables rules is to allow all on 192.168.x.x - pff ...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum