2298 views|17 replies

6742

Posts

2

Resources
The OP
 

Raspberry Pi has one network port and two IPs? ? ? [Copy link]

 

The thing is, I set a static IP for the Raspberry Pi's eth0, but when I used the static IP to log in remotely (ssh), it was normal. However, when I used [ifconfig] to query the IP, it was actually another IP. I used my computer to ping both IPs and they were both normal. I could also log in remotely (ssh) normally. It was indeed the same Raspberry Pi that I logged in to (because the file contents were the same). What's going on? Has anyone encountered this strange problem?

Static IP settings

Query the IP

The two IPs can ping normally.

This post is from Embedded System

Latest reply

One active and one static? Then you can only have one IP at the same time! [/quote] Set up a static IP. One IP for the network cable and one for wireless?  Details Published on 2023-4-21 12:27

6742

Posts

2

Resources
2
 

To clarify, there is no WIFI connection to the router.

This post is from Embedded System
 
 

2926

Posts

0

Resources
3
 

Check if the main router has IP address port forwarding set up. That is, forwarding 88 to 157, or 157 to 88.

This post is from Embedded System

Comments

No, the router is just used normally and no special design is done.  Details Published on 2023-4-20 13:06
 
 
 

6742

Posts

2

Resources
4
 
tagetage posted on 2023-4-20 10:06 Is the main router set up with IP address port forwarding. That is, 88 forwards to 157, or 157 forwards to 88.

No, the router is just used normally and no special design is done.

This post is from Embedded System
 
 
 

2926

Posts

0

Resources
5
 

How did you set a fixed IP for the Raspberry Pi? The static IP should be configured in /etc/dhcpcd.conf, not in /etc/network/interfaces. Otherwise, once you apply for a static IP, DHCP will also assign one to you.

Most methods on the Internet are to modify the /etc/network/interfaces configuration file and add static IP settings. However, the method of setting a static IP on the Raspberry Pi by modifying interfaces is not perfect. Even if a static IP is obtained, the DHCP service will still automatically assign a dynamic IP and DNS address to the Raspberry Pi, resulting in a conflict in the default gateway of the routing table and the failure of the manually given default DNS to take effect.

This post is from Embedded System

Comments

The file I set is [/etc/dhcpcd.conf]. There was a time before when two IPs could ping each other, but I didn’t pay much attention to it at that time. I reset the static IP yesterday, but the problem occurred again today.  Details Published on 2023-4-20 14:12
 
 
 

6742

Posts

2

Resources
6
 
tagetage posted on 2023-4-20 13:18 How do you set a fixed IP for Raspberry Pi? Static IP should be configured in /etc/dhcpcd.conf, not in /etc/network/interfaces...

The file I set is [/etc/dhcpcd.conf]. There was a time before when two IPs could ping each other, but I didn’t pay much attention to it at that time. I reset the static IP yesterday, but the problem occurred again today.

This post is from Embedded System

Comments

Your Raspberry Pi has not been installed for a long time. You can reinstall the system and then change the IP.  Details Published on 2023-4-20 15:45
 
 
 

2926

Posts

0

Resources
7
 
wangerxian posted on 2023-4-20 14:12 The file I set is [/etc/dhcpcd.conf]. There was a time before when two IPs could ping each other. I didn’t pay attention to it at that time. I reset it yesterday...

Your Raspberry Pi has not been installed for a long time. You can reinstall the system and then change the IP.

This post is from Embedded System

Comments

I used an image of a certain product and cannot reinstall the system. I am just curious why there is such a strange problem? Does the Raspberry Pi have its own IP forwarding function?  Details Published on 2023-4-20 16:28
 
 
 

6742

Posts

2

Resources
8
 
tagetage posted on 2023-4-20 15:45 Your Raspberry Pi has not been installed for a long time. You can reinstall the system and then change the IP.

I used an image of a certain product and cannot reinstall the system. I am just curious why there is such a strange problem? Does the Raspberry Pi have its own IP forwarding function?

This post is from Embedded System
 
 
 

2926

Posts

0

Resources
9
 

Your original product image should have a DHCP assigned IP. For the convenience of debugging, you added a fixed IP, but the Raspberry Pi has 2 IPs.

The correct approach is to add MAC address and IP binding settings to the main router, so that the IP assigned by DHCP to the Raspberry Pi is a fixed IP.

Why are there 2 IP addresses, similar to the following situation,

Most methods on the Internet are to modify the /etc/network/interfaces configuration file and add static IP settings. However, the method of setting a static IP on the Raspberry Pi by modifying interfaces is not perfect. Even if a static IP is obtained, the DHCP service will still automatically assign a dynamic IP and DNS address to the Raspberry Pi, which will result in the Raspberry Pi having two IP addresses , causing conflicts in the default gateway of the routing table, and the manually given default DNS will not take effect.

This post is from Embedded System
 
 
 

4764

Posts

12

Resources
10
 
You can use the router to assign a fixed IP address to it.
This post is from Embedded System

Comments

One moving and one static? Then you can only have one IP at the same time!  Details Published on 2023-4-21 09:37
 
 
 

4764

Posts

12

Resources
11
 
I let the router give 3b a fixed IP address of 7. It has been running for half a year without any problems.
This post is from Embedded System

Comments

I have the same problem at home, but I don't know why it has this problem, and I can't see anything wrong with the configuration.  Details Published on 2023-4-21 09:37
 
 
 

4817

Posts

4

Resources
12
 

What can you see if you use the ifconfig eth0 command to display the information of the eth0 interface?

This post is from Embedded System

Comments

The one in Figure 2 is that it does not show the static IP I set.  Details Published on 2023-4-21 09:38
 
 
 

6742

Posts

2

Resources
13
 
Azuma Simeng posted on 2023-4-20 17:08 I let the router give 3b a fixed ip 7. It has been running for half a year and nothing has happened~

I have the same problem at home, but I don't know why it has this problem, and I can't see anything wrong with the configuration.

This post is from Embedded System
 
 
 

6742

Posts

2

Resources
14
 
Azuma Simeng posted on 2023-4-20 17:07 One active and one static IP. You can let the router fix one for him

One moving and one static? Then you can only have one IP at the same time!

This post is from Embedded System

Comments

How about setting up a static IP for both of you, one for the network cable and one for the wireless?  Details Published on 2023-4-21 12:27
 
 
 

6742

Posts

2

Resources
15
 
led2015 posted on 2023-4-20 22:46 What can you see if you use the ifconfig eth0 command to display the information of the eth0 interface

The one in Figure 2 is that it does not show the static IP I set.

This post is from Embedded System
 
 
 

4764

Posts

12

Resources
16
 
Azuma Simeng posted on 2023-4-20 17:07 One active and one static IP. You can let the router fix one for him.
One active and one static? Then you can only have one IP at the same time!
Set up a static IP. One IP for the network cable and one for wireless?
This post is from Embedded System

Comments

It's a wired one, no wireless connection.  Details Published on 2023-4-22 08:03
It's a wired one, no wireless connection.  Details Published on 2023-4-22 08:03
 
 
 

6742

Posts

2

Resources
17
 
Azuma Simeng posted on 2023-4-21 12:27 One active and one static? Then you can only have one IP at the same time! [/quote] Set up a static IP, one for the network cable and one for wireless?

It's a wired one, no wireless connection.

This post is from Embedded System
 
 
 

6742

Posts

2

Resources
18
 
Azuma Simeng posted on 2023-4-21 12:27 One active and one static? Then you can only have one IP at the same time! [/quote] Set up a static IP, one for the network cable and one for wireless?

This strange phenomenon occurs when a static IP is set.

This post is from Embedded System
 
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list