LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-02-2016, 03:07 AM   #1
venkat.gadamsetti
LQ Newbie
 
Registered: Aug 2016
Posts: 1

Rep: Reputation: Disabled
How to Block ipv4 address access in linux system


Hi,
I have to block ipv4 access to my linux system and i want alow only ipv6 access.
what is the best way to block ipv4 access..?
can i use any iptable rule to block all ipv4 address?
Thanks
venkat.
 
Old 08-02-2016, 08:28 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,632

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by venkat.gadamsetti View Post
Hi,
I have to block ipv4 access to my linux system and i want alow only ipv6 access. what is the best way to block ipv4 access..? can i use any iptable rule to block all ipv4 address?
You provide no useful details, so there's little we can tell you. You say nothing about version/distro of Linux, your network environment, what's currently running, or what you're actually trying to accomplish. Read the "Question Guidelines" link in my posting signature.

Want to allow only ipv6? Then don't give out/use/allow ANY ipv4 traffic on your internal network, period. Or, only have your network services listen/use IPv6 addresses...
 
Old 08-02-2016, 08:33 AM   #3
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
If the NIC has no IPv4 address then obviously there cannot be any IPv4 connections.
 
1 members found this post helpful.
Old 08-02-2016, 09:03 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,632

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Emerson View Post
If the NIC has no IPv4 address then obviously there cannot be any IPv4 connections.
Was thinking the exact same thing.
 
Old 08-02-2016, 10:50 AM   #5
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,474

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by Emerson View Post
If the NIC has no IPv4 address then obviously there cannot be any IPv4 connections.
If someone manually ARPs an IP to the MAC then wouldn't it respond for anything that's bound to * ?
 
Old 08-02-2016, 02:47 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,976

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
arp wouldn't work, I don't think but I'd like to see what TenTenths was going to do. May be a thing I haven't seen.

One can simply not assign an ipv4 address or no gateway is normal.

One could block in iptables pretty sure.

Last edited by jefro; 08-07-2016 at 02:42 PM.
 
Old 08-06-2016, 01:34 AM   #7
jnihil
Member
 
Registered: Dec 2012
Location: inside the matrix
Distribution: Debian, Xubuntu, Gentoo, Antergos
Posts: 90

Rep: Reputation: 27
Quote:
If someone manually ARPs an IP to the MAC then wouldn't it respond for anything that's bound to * ?
ipv6 doesn't use arp.
 
Old 08-08-2016, 12:24 PM   #8
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
If you are looking to block all IPv4 and allow IPv6 then simply setup the IPv4 firewall as follows:

Code:
iptables -X
iptables -F
iptables -Z
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
Now all IPv4 traffic is dropped. Save your rules so they are reloaded when the system is restarted.

Last edited by lazydog; 08-08-2016 at 02:02 PM. Reason: Fixed firewall rules.
 
1 members found this post helpful.
Old 08-09-2016, 11:56 AM   #9
Ellendhel
Member
 
Registered: Aug 2015
Location: Wilmington, NC
Distribution: Slackware
Posts: 64

Rep: Reputation: 51
Quote:
Originally Posted by lazydog View Post
Now all IPv4 traffic is dropped.
I would still allow IPv4 for localhost, there is probably still some applications that will try to access to 127.0.0.1, regardless of the IP stack in use.

Code:
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Drop or Block Incoming Access From Specific IP Address Using Iptables jaydul Linux - Newbie 1 10-17-2013 09:10 PM
block access to a site from all but one ip address steve51184 Linux - Server 2 12-10-2008 09:14 PM
by using iptables block mac address to restric user to access internet Farrukh Fida Linux - Networking 3 10-09-2006 07:59 AM
block ipv4 and not ipv6 linuxtesting2 Linux - Networking 0 04-29-2004 12:16 PM
Block access by ip address on Smoothwall. chrisknight Linux - Software 6 09-21-2003 08:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration