Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
iptables-restore --noflush is not working
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
dashang
n00b
n00b


Joined: 22 Jul 2011
Posts: 40

PostPosted: Mon Apr 23, 2012 10:43 am    Post subject: iptables-restore --noflush is not working Reply with quote

iptables-restore default behavior is to flush all table and then apply all chain. but there is one option in iptables-restore is --noflush
Quote:

iptables-restore --help
Usage: iptables-restore [-b] [-c] [-v] [-t] [-h]
[ --binary ]
[ --counters ]
[ --verbose ]
[ --test ]
[ --help ]
[ --noflush ]
[ --table=<TABLE> ]
[ --modprobe=<command>]

means old rules is not deleted ..
so i have create two file a.txt and b.txt file

[b] vi a.txt


Quote:

*mangle
:acctup - [0:0]
:acctdn - [0:0]
-I acctup -s 10.104.1.122 -d 0/0 -j MARK --set-mark 1
-I acctdn -d 10.104.1.122 -s 0/0 -j MARK --set-mark 1
COMMIT
*nat
-A POSTROUTING -s 10.104.1.122 -d 0/0 -j MASQUERADE
COMMIT



vi a.txt

Quote:

*mangle
:acctup - [0:0]
:acctdn - [0:0]
-I acctup -s 10.104.1.121 -d 0/0 -j MARK --set-mark 1
-I acctdn -d 10.104.1.121 -s 0/0 -j MARK --set-mark 1
COMMIT
*nat
-A POSTROUTING -s 10.104.1.121 -d 0/0 -j MASQUERADE
COMMIT




now when i run this file with --noflush option . but still its delete all the rules.....


Quote:


iptables-restore --noflush < a.txt
iptables -t mangle -L acctup -nvx

Chain acctup (0 references)
pkts bytes target prot opt in out source destination
0 0 MARK all -- * * 10.104.1.122 0.0.0.0/0 MARK xset 0x1/0xffffffff



iptables-restore --noflush < b.txt
iptables -t mangle -L acctup -nvx

Chain acctup (0 references)
pkts bytes target prot opt in out source destination
0 0 MARK all -- * * 10.104.1.121 0.0.0.0/0 MARK xset 0x1/0xffffffff
root@bhushan:/home/bhushan#



So after run b.txt iptables-restore --noflush delete all chain ...my ip is change every time...so its dynamic ....

PLEASE TELL ME THE SOLUTION ......how to work in iptables-restore --noflush option.....[/b]
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