The two computers in the LAN cannot be set to the same IP address, otherwise the IP address will conflict, and one computer will always be unable to access the LAN resources. For example, if your gateway is 192.168.1.1, then your subnet mask is 255.255.255.0, and the IP address of the two computers is 192.168.1. X, where X is any natural number from 2 to 254, In other words, there can be 253 computers in your LAN. Just set the IP address as I said.
In addition, it is not necessary to specify an IP address in the following cases:
If you want to share the Internet, you must have a router. After setting up the router, as long as your network cable is connected correctly, you do not need to set an IP address, and you can automatically obtain it, including the DNS server. If your router is set correctly, you can directly connect to the Internet.