Linux - Removing all IP information from an interface

If an interface has already had IP addresses assigned to it, and all of the addresses need to be removed (along with their routes), there is one handy command to accomplish all of these tasks. ip address flush takes an interface name as an argument. Let’s look at the output of ip address show just before and just after removing all IPs. [root@logistic]# ip address show dev eth0 2: eth0: <BROADCAST,MULTICAST,UP mtu 1500 qdisc pfifo_fast qlen 100 link/ether 00:80:c8:f8:4a:51 brd ff:ff:ff:ff:ff:ff inet 192.168.99.35/24 brd 192.168.99.255 scope global eth0 inet 192.168.99.37/24 brd 192.168.99.255 scope global secondary eth0:0 [root@logistic]# ip address flush Flush requires arguments. [root@logistic]# ip address flush dev eth0 [root@logistic]# ip address show dev eth0 2: eth0: <BROADCAST,MULTICAST,UP mtu 1500 qdisc pfifo_fast qlen 100 link/ether 00:80:c8:f8:4a:51 brd ff:ff:ff:ff:ff:ff

22 July 2010 @ 23:44 · Updated: 30 June 2026 @ 03:28 · leo

Iptables Flush

Full flush iptables script: #!/bin/sh iptables -F iptables -X iptables -t nat -F iptables -t nat -X iptables -t mangle -F iptables -t mangle -X iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT

2 December 2009 @ 07:15 · Updated: 30 June 2026 @ 03:28 · leo