Le 03/11/2017 à 10:32, Debian EN a écrit :
Hello to all :-) I've fastweb italian adsl
2 networks interfaces:
wan 192.168.0.2/31 --> modem 192.168.0.1/31
eth0 192.168.1.0/24
everything works but:
Really ? It shouldn't.
192.168.0.1/31 and 192.168.0.2/31 are not in the same subnet.
$ ipcalc 192.168.0.1/31
Address: 192.168.0.1 11000000.10101000.00000000.0000000 1
Netmask: 255.255.255.254 = 31 11111111.11111111.11111111.1111111 0
Wildcard: 0.0.0.1 00000000.00000000.00000000.0000000 1
=>
Network: 192.168.0.0/31 11000000.10101000.00000000.0000000 0
HostMin: 192.168.0.0 11000000.10101000.00000000.0000000 0
HostMax: 192.168.0.1 11000000.10101000.00000000.0000000 1
Hosts/Net: 2 Class C, Private Internet, PtP Link RFC 3021
$ ipcalc 192.168.0.2/31
Address: 192.168.0.2 11000000.10101000.00000000.0000001 0
Netmask: 255.255.255.254 = 31 11111111.11111111.11111111.1111111 0
Wildcard: 0.0.0.1 00000000.00000000.00000000.0000000 1
=>
Network: 192.168.0.2/31 11000000.10101000.00000000.0000001 0
HostMin: 192.168.0.2 11000000.10101000.00000000.0000001 0
HostMax: 192.168.0.3 11000000.10101000.00000000.0000001 1
Hosts/Net: 2 Class C, Private Internet, PtP Link RFC 3021
If the prefix length on the modem is really /31, then the only other
address in the same subnet is 192.168.0.0, not 192.168.0.2.
At first glance it may look odd because this address is usually reserved
as the network address, but /31 is an exception per RFC 3021 : the two
addresses are usable as host addresses on a point-to-point link, there
are neither reserved network nor directed broadcast addresses. Otherwise
a /31 subnet would be useless, as it would contain only the reserved
network and broadcast addresses, leaving no room for host addresses.
But are you sure the prefix length on the modem is /31 and not /30 ?
With /30, 192.168.0.1 and 192.168.0.2 would be the two host addresses in
the subnet.
$ ipcalc 192.168.0.1/30
Address: 192.168.0.1 11000000.10101000.00000000.000000 01
Netmask: 255.255.255.252 = 30 11111111.11111111.11111111.111111 00
Wildcard: 0.0.0.3 00000000.00000000.00000000.000000 11
=>
Network: 192.168.0.0/30 11000000.10101000.00000000.000000 00
HostMin: 192.168.0.1 11000000.10101000.00000000.000000 01
HostMax: 192.168.0.2 11000000.10101000.00000000.000000 10
Broadcast: 192.168.0.3 11000000.10101000.00000000.000000 11
Hosts/Net: 2 Class C, Private Internet