I am in need to test our connectivity of our device (specifically, how our device responds when unable to reach certain ports).
So I am trying to control the ports, by sharing the internet connection from my computer to our device, through ethernet.
All I have to do to share internet with another device:
- open ubuntu settings
- click gearbox on network -> wired connection
- under ip4, selected "shared to other computers"
This is nice, so I can test the connectivity of our device in the "good weather scenario".
Now, I am trying to disable mqtt (port 1883) or http (port 80). I am trying to use iptables, and reject all outgoing traffic to port 80 as follows:
sudo iptables -I OUTPUT 1 -o enxe8ea6a7effac -p tcp --dport 80 -j REJECT
enxe8ea6a7effac is the ethernet connection on the host computer which is sharing the wired connection.
When I remove/connect the physical cable, our device tries to reconnect using ethernet, and still is able to send out HTTP GET/POST requests.
Why isn't the ip rule working? I am 100% sure I am setting the rules for the correct interface.