哪些 IP 地址不能绑定到侦听套接字?
例如,服务器进程能否将 255.255.255.255 绑定到监听套接字?
谢谢。
哪些 IP 地址不能绑定到侦听套接字?
例如,服务器进程能否将 255.255.255.255 绑定到监听套接字?
谢谢。
根据https://networkengineering.stackexchange.com/a/57909/,发送到 192.168.1.97 的数据包“不会离开主机,而是被视为从网络接收到的数据包,地址为 192.168.1.97。” 与发送数据包环回 127.0.0.1 相同。
为什么nmap 127.0.0.1
返回的服务多于nmap 192.168.1.97
?
是否nmap 127.0.0.1
一定也返回由返回的那些服务nmap 192.168.1.97
?监听的服务器是否192.168.1.97
也必须监听127.0.0.1
?
$ nmap -p0-65535 192.168.1.97
Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-23 19:18 EDT
Nmap scan report for ocean (192.168.1.97)
Host is up (0.00039s latency).
Not shown: 65532 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
3306/tcp open mysql
33060/tcp open mysqlx
Nmap done: 1 IP address (1 host up) scanned in 9.55 seconds
$ nmap -p0-65535 localhost
Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-23 19:18 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00033s latency).
Other addresses for localhost (not scanned):
Not shown: 65529 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
631/tcp open ipp
3306/tcp open mysql
5432/tcp open postgresql
9050/tcp open tor-socks
33060/tcp open mysqlx
Nmap done: 1 IP address (1 host up) scanned in 5.39 seconds
谢谢。
是docker0
,lo
并且 virbr0
是虚拟网络接口?
为什么分配私有docker0
而virbr0
不是环回IP地址?
如果私有 IP 地址可以像环回地址一样工作,是否可以lo
分配一个私有 IP 地址而不是环回 IP 地址?
环回地址是127.*.*.*
. 它们是否总是形成一个网络,而不是像示例中那样被分成几个较小的网络?
192.168.*.*
是一系列私有 IP 地址。它们是否经常分成几个较小的网络,如示例 (wlx8
和virbr0
)?
谢谢。
$ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:a6:79:a6:bc txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 1552397 bytes 88437726 (88.4 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1552397 bytes 88437726 (88.4 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:b1:aa:1f txqueuelen 1000 (Ethernet)
RX packets 123 bytes 12102 (12.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 39 bytes 4300 (4.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlx8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.97 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::a0df:c436:afb1:8b45 prefixlen 64 scopeid 0x20<link>
ether txqueuelen 1000 (Ethernet)
RX packets 991338 bytes 536052615 (536.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 618233 bytes 101520924 (101.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
$ sudo netstat -ap | grep postg
tcp 0 0 localhost:postgresql 0.0.0.0:* LISTEN 1567/postgres
udp 0 0 localhost:57504 localhost:57504 ESTABLISHED 1567/postgres
unix 2 [ ACC ] STREAM LISTENING 27116 1567/postgres /var/run/postgresql/.s.PGSQL.5432
$ sudo netstat -ap | grep mysql
tcp6 0 0 [::]:mysql [::]:* LISTEN 23683/mysqld
tcp6 0 0 [::]:33060 [::]:* LISTEN 23683/mysqld
unix 2 [ ACC ] STREAM LISTENING 1169294 23683/mysqld /var/run/mysqld/mysqld.sock
unix 2 [ ACC ] STREAM LISTENING 1169513 23683/mysqld /var/run/mysqld/mysqlx.sock
unix 2 [ ] DGRAM 1169211 23683/mysqld
0.0.0.0:*
,[::]:mysql
和是什么[::]:*
意思?
*
是指所有端口吗?
0.0.0.0
根据 Tanenbaum 的计算机网络,意思是“这个网络”或“这个主机”。什么时候用于这个网络,什么时候用于这个主机?
谢谢。
我有一个包含 IP 和端口号的文件。我想取出端口号并保留IP。
xyz 10.93.10.13:58160).
xyz 10.93.10.13:58161).
xyz 10.18.104.181:12466).
xyz 10.93.10.13:60585).
wxy 10.93.10.13:60586).
wxy 10.93.10.13:60587).
ADMIN loopback[127.0.0.1]:33955).
ADMIN loopback[127.0.0.1]:33957).
ADMIN loopback[127.0.0.1]:33961).
ADMIN loopback[127.0.0.1]:33962).
预期产出
xyz 10.93.10.13
xyz 10.93.10.13
xyz 10.18.104.181
xyz 10.93.10.13
wxy 10.93.10.13
wxy 10.93.10.13
ADMIN loopback[127.0.0.1]
ADMIN loopback[127.0.0.1]
ADMIN loopback[127.0.0.1]
ADMIN loopback[127.0.0.1]
我尝试了一个行不通的蹩脚程序
cat 1.txt|grep -v [:12312]
谢谢