Question: iptables filters the address of the mongodb link, iptablesmongodb
HOST: aws ec2 linux
Service: mongodb
Iptables rules:
1. The host allows the specified pc to access port 27017.
Iptables-I INPUT-p tcp -- dport 51376-m mac -- mac-source xx: xx-j ACCEPT
2. The host allows access from the network segment 172.31.0.0/16 to 27017.
Iptables-I INPUT-s 172.31.0.0/16-p tcp -- dport 27017-j ACCEPT
3. The host rejects access from any address.
Iptables-a input-p tcp -- dport 27017-j DROP
Description:
Allow the specified pc connection to port 27017 to facilitate the programmer's link to the inverted library for debugging.
For the sake of database security and the communication between database cluster nodes, in addition to the local lan cidr block of 172.31.0.0/16, port 27017 is denied from any link to the address.
Problem:
The iptables configuration is correct. log on to the host with the specified mac address. Failed to send logon. The link is rejected.
After the mongodb host captures the packet, the mac address in the packet does not match the mac address set in iptables. That is to say, the mac address in the packet received by the host is not from the host.