I am creating a new Virtual Interface:
ifconfig eth0:0 123.123.22.22
The command netstat -tlnp
returns something like this:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:50505 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:7337 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:3790 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 2450/Xvnc4
tcp 0 0 0.0.0.0:6002 0.0.0.0:* LISTEN 2626/Xvnc4
tcp 0 0 192.168.2.77:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:3001 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:52698 0.0.0.0:* LISTEN 3488/plugin_host
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN -
tcp6 0 0 ::1:7337 :::* LISTEN -
tcp6 0 0 :::5901 :::* LISTEN 2450/Xvnc4
tcp6 0 0 :::5902 :::* LISTEN 2626/Xvnc4
tcp6 0 0 ::1:631 :::* LISTEN -
tcp6 0 0 ::1:5432 :::* LISTEN -
tcp6 0 0 ::1:6010 :::* LISTEN -
So, if I make nmap
for both virtual and physical interface the result will be the same (This is explained with the value of "Local Address" in netstat
). I tried to close the ports (5901,5902,6001,6002) in this new virtual interface.
The nmap
for both interfaces:
PORT STATE SERVICE
5901/tcp open vnc-1
5902/tcp open vnc-2
6001/tcp open X11:1
6002/tcp open X11:2
Command:
sudo iptables -A INPUT -i eth0:0 -p tcp --dport 5901 -j DROP
The port will be unreachable, but open (for nmap
). Is there any way to prevent eth0:0
from listening for traffic from 0.0.0.0
?
If a host has two IP addresses, 192.168.1.1 and 10.1.2.1, and a server running on the host listens on 0.0.0.0, it will be reachable at both of those IPs. (wiki)
Goals:
- Expose new Interfaces in LAN, and change the Mac Address (will look like another machine)
- Bind docker containers to the new recently created Interfaces, exposing services in certain ports.
modprobe
and the result is the same – jcardosovtl Dec 06 '17 at 10:35