For example, 127.0.0.1
:
127 0 01111111 00000000 0 1 00000000 00000001
192.168.1.0/24
represent?
192.168.1.0
to 192.168.1.255
!
192.168.1.0/24
means "all the IP addresses that have
the same 24 bits as 192.168.1.0
". There are 2^(32 - 24)
IP addresses like that, or 256 -- everything from 192.168.1.0
to 192.168.1.255
.
this is called "CIDR notation"
Here's how a TCP packet is structured:
+-+-+-+-+-+-+-+-+--+- | Ethernet header | +-+-+-+-+-+-+-+-+--+- | IP header | +-+-+-+-+-+-+-+-+--+- | TCP header | +-+-+-+-+-+-+-+-+-+-+ | packet contents | +-+-+-+-+-+-+-+-+-+-+
the IP header contains a source and destination IP address, a TTL, a length field, and a few more things.
It's structured the same way as a TCP packet, except with a UDP header instead of a TCP header.
the IP header contains an IP address, but no port. For example, ICMP
packets (the kind of packet ping
sends) have an IP address
but no port. TCP and UDP packets have a port.
10.11.12.13
?
These 3 IP ranges are reserved for private networks:
10.0.0.0 – 10.255.255.255
172.16.0.0 – 172.31.255.255
192.168.0.0 – 192.168.255.255
127.0.0.0/8
is also reserved for connections inside the
same computer.
192.168.1.123
and it sends a packet to google.com, is
192.168.1.123
the source IP address on the packet when
it gets to google.com?
192.168.1.123
is a local IP address, so Google would have
no way of knowing how to contact your computer. Instead, your router
rewrites the packet to have your computer's public IP on it instead. This
is called "network address translation" or "NAT".
the length field on an IPv4 packet is 16 bits, so the maximum length is 65535.
in practice network packets often have to be even smaller than that -- a common limit is 1500 bytes (google "MTU" to learn more)
They don't generally use any other information from the packet.
A lot of services use your source IP address to decide what country you're in. This is why a lot of people use VPNs -- they proxy their browsing through the VPN so that the source IP address on their packets is in a different country.
it means after it's made about 63 hops (to 63 servers or routers), it won't be sent further!
The TTL ("time to live") IP field exists so that packets don't get stuck going in a loop on the internet forever.
192.168.0.1/12
) to an IP range