my RPi using Raspian, connected to a switch using DHCP, and I remote it by SSH. the first time I found RPI's IP by switch IP table and accessed successfully , but after reboot, I can't connect to my RPi anymore, and it's IP not in switch ip table as well. After many try, unplugg to connect and nmap to find ip, I figured out that : RPi have IP address when power on RPi without connect to switch for 10 -20s and then connect it to switch, I nmap to find it's IP. This problem is so annoying :oops: , I can't access it after reboot.
In terms of networking the first thing i would check in the following order:
- Check the physical connection.
- Check if the router is registering the raspberry pi connection. (If it isn't restart your router)
- Check if the raspberry pi can directly connect to the switch or router (as close to the desired destination)
- If you are still experiencing problems, just do a general connectivity test without any advance settings, and if it works apply the relevant network connection changes while monitoring the connection on the router/switch.
(Doing a trace route can also solve a lot of problems troubleshooting wise)
You can use a dynamic domain name server like DynDNS if there's internet access to keep track of the IP address. Alternatively, your router may do this automatically. On my network a simple "ssh raspberrypi" almost always works because when the DHCP lease is requested, the Pi sends it's domain name along, which the router then puts in its local DNS service.
Are you sure that your switch has DHCP? Not all switches have DHCP.
You can create a script to ping all posible IPs.
Also yo can conect a monitor and a keyword to RPi and see the output of ifconfig command in RPi.
Other posible solution is connect direct to RPi and asign a fixed IP, then when you connect to switch the RPi have the fixed IP.
Please check /etc/hosts and /etc/hostname for the name of your system or set it to your wishes. Preset values may differ with the flavour of your OS (e.g. "raspberrypi"). Within your own subnet, that is behind your switch/router (assuming reasonable hardware and software on all parts within that network), you should be able to connect to your RPi using that hostname.