Linux interface is used only for raw socket

I have an OpenWrt distribution for my embedded system. The device has 3 network interfaces: eth0, eth1 and wlan0.

One of the network interfaces (eth0) should only be used for socket programming. I can create a socket with parameters AF_PACKET, SOCK_RAW, ETH_P_ALL. The socket receives all the network traffic, I can send packets, and everything is fine.

But my problem is that the OS also uses an interface to send regeneration (e.g. ARP and ICMP requests / responses).

Is there an option that the interface is used only by my program, and not by the OS itself?

+4
source share
1

. :

arp :

echo 8 > /proc/sys/net/ipv4/conf/eth0/arp_ignore

IPv6:

echo 1 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6

, IPv4,

iptables -I INPUT -i eth0 -j DROP

IP- . , , , , , .

+2

Source: https://habr.com/ru/post/1680830/


All Articles