Hai máy tính trên cùng một mạng Wi-Fi có cùng địa chỉ IP không?

Mục lục:

Hai máy tính trên cùng một mạng Wi-Fi có cùng địa chỉ IP không?
Hai máy tính trên cùng một mạng Wi-Fi có cùng địa chỉ IP không?

Video: Hai máy tính trên cùng một mạng Wi-Fi có cùng địa chỉ IP không?

Video: Hai máy tính trên cùng một mạng Wi-Fi có cùng địa chỉ IP không?
Video: Cách biến Windows thành Macos Big Sur - YouTube 2024, Có thể
Anonim
Khi bạn mới bắt đầu tìm hiểu về mạng và cách địa chỉ IP hoạt động, tất cả dường như có vẻ hơi áp đảo, nhưng với một chút nghiên cứu, bạn có thể hiểu cách mọi thứ kết hợp với nhau. Bài đăng Hỏi & Đáp của SuperUser hôm nay giúp người đọc nhầm lẫn tìm hiểu về cách địa chỉ IP hoạt động cho mạng Wi-Fi của anh ấy.
Khi bạn mới bắt đầu tìm hiểu về mạng và cách địa chỉ IP hoạt động, tất cả dường như có vẻ hơi áp đảo, nhưng với một chút nghiên cứu, bạn có thể hiểu cách mọi thứ kết hợp với nhau. Bài đăng Hỏi & Đáp của SuperUser hôm nay giúp người đọc nhầm lẫn tìm hiểu về cách địa chỉ IP hoạt động cho mạng Wi-Fi của anh ấy.

Phiên Hỏi & Đáp hôm nay đến với chúng tôi theo lịch sự của SuperUser - một phân khu của Stack Exchange, một nhóm các trang web Hỏi & Đáp do cộng đồng điều hành.

Ảnh chụp màn hình lịch sự của Ảnh chụp màn hình Linux (Flickr).

Câu hỏi

Người đọc siêu người dùng Thomas muốn biết liệu cả hai máy tính trong nhà của anh ta có cùng địa chỉ IP hay không:

This question might seem stupid, but I wondered if two computers on the same Wi-Fi network have the same IP address? For example, my dad’s computer and my computer at home.

If so, how does the outside world distinguish one computer from the other (like when a server wants to send some data back to us)?

Hai máy tính có cùng địa chỉ IP hay không?

Câu trả lời

Người đóng góp của SuperUser Reaces và Abraxas có câu trả lời cho chúng tôi. Đầu tiên, Reaces:

Both computers are seen as having the same IP address externally. Your router will relay requests to the originating computer and the procedure used for this is Network address translation.

However, if you were to try to communicating with your father’s computer, you would use your internal addresses. These use a custom range intended for internal use only: private address range.

Tiếp theo là câu trả lời từ Abraxas:

Here is a very quick outline of how IP addressing works in this situation:

You have your home computer with a network interface (Ethernet port or Wi-Fi card) and each of these have unique MAC addresses which identify them globally.

Network interfaces are given IP addresses by your router/modem/switch/access point. Your access point (AP) is part of or connected to a modem/router/switch which gives the AP an IP. This is how things look so far:

Your Computer (IP) –> Access Point (IP) –> Cable Modem (IP)

Here is an example of what those IP addresses might be like. In the example, the 4th octet (the last number of each set) determines your device’s IP address, the 3 to the left of them determine the devices network.

192.168.1.50 –> 192.168.1.25 –> 192.168.1.1

Essentially, in this example, the modem creates a network called 192.168.1. All devices on the network are given a different x value (1-255), the last digit.

Here is an important distinction. There are 2 types of IPv4 IP addresses, Public and Private. Public IP addresses are the ones you see on the Internet (if you ping google.com you will get a public IP address). Inside of a network you typically have a Private IP address setup (192.168.x.x, 172.x.x.x, and 10.x.x.x) are all IP addresses that do not exist on web servers on the Internet, they are reserved for local networks.

Typically, your home network has a gateway which is something like x.x.x.1 (192.168.1.1 or 10.1.1.1 for instance). This means that they are not accessible from the outside world, they are meant to be inside your network.

How do internal network devices get on the internet then?

If you go to Whatismyip.com, you will see an IP address listed that is not your computer, your AP, or your modem/router. This is your Public IP address.

Typically your modem/router has two functions:

  1. Receive an IP address from the outside world and talk to your ISP’s network with that address.
  2. Create an internal network and let them talk through its external interface.

So here, effectively, is what your modem does:

Public IP (Cable Jack) –> [Modem] –> Private Network (IP) –> Ethernet Ports –> [Computers]

The modem bridges the public Internet to your network. requests from your internal network get sent to your modem which forwards them to the Internet. This way only one public IP address is needed for all of your devices to talk to the Internet.

On the Internet side of the modem, you have an IP address assigned by your ISP which is the one Whatismyip.com shows you. This is put ‘on’ the interface of your modem which is attached to your cable/DSL/T1 line. The other side of the modem/router (where you plug in your access point, switch, or computers) is given an IP address that you can configure. The way people are able to have servers visible to the public is that they can tell the modem things like this: “When a request comes to our PUBLIC IP ADDRESS asking for a resource, connect that traffic to INTERNAL IP ADDRESS OF RESOURCE.”

When you send a message your computers, the IP address basically becomes ‘encapsulated’ within various ‘headers’ of your data. Ultimately, the computers seeing your traffic see the external IP address from your modem and not your physical computers internal IP address. More data is sent containing MAC addresses and things like that, but essentially one public IP address can represent an entire network of devices behind it.

More information can be found here: What is an IP address? (Or all over the internet.)

NAT is the process by which your router translates the internal addresses to your public address and your public incoming traffic to the correct internal IP address.

There is a lot more to it, but that should provide the general gist of it.

Có cái gì để thêm vào lời giải thích? Tắt âm thanh trong các ý kiến. Bạn muốn đọc thêm câu trả lời từ những người dùng Stack Exchange có hiểu biết công nghệ khác? Xem toàn bộ chuỗi thảo luận tại đây.

Đề xuất: