PYNQ: PYTHON PRODUCTIVITY

How to assign static IP to Pynq board?

I have connected Pynq Z2 board with my lab’s Ethernet port. And I have got static IP from the network administrator to assign to my Pynq board. How can I assign the static IP to Pynq board.
If I see the current output of ifconfig, I see eth0 and lo only. eth0 has some inet address which can not be pinged from Windows.

Any help is appreciated.

Check /etc/network/interfaces.d/eth0 on your board. And adjust it based on your need.

I have tried over there. I changed the address to static IP provided by administrator but it did not work. The board is not able to connect to internet. The file looks like this.

auto eth0
iface eth0 inet dhcp
auto eth0
iface eth0 inet static
address 192.168.2.99 (Changed this with the provided static IP)
netmask 255.255.255.0

What do you mean “The board is not able to connect to internet”? Do you mean external internet, or that you can’t connect to the board over the network i.e. from Jupyter?
If external internet, check if there is a proxy on your lab network that you need to config settings for on the board.

If you can’t connect to the board from Jupyter, for the IP, did you reboot and verify your changes?
Did you check what the IP address is?

   ifconfig

Cathal

1 Like

“The board is not able to connect to internet”, I cannot ping any IP from terminal which means there is no internet.
“If external internet, check if there is a proxy on your lab network that you need to config settings for on the board.” There is no proxy on the lab’s network. We just assign static IP to PC and we can connect to internet.

“If you can’t connect to the board from Jupyter, for the IP, did you reboot and verify your changes? Did you check what the IP address is?” Yes. I rebooted the system and I can see that IP gets updated to the IP that I assign.

This isn’t accurate, ping can be blocked on a network.

“The board is not able to connect to internet”, I cannot ping any IP from terminal which means there is no internet.

It might help if you can post the output of ipconfig. Can you ping the board from your host computer, and can you share the IP details of both board and computer?

If you have set the IP correctly, then this is all you need to do on the board. You might need to check with your system administrators.

Cathal

Here is the output of ifconfig:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 140.115.72.167  netmask 255.255.255.0  broadcast 140.115.72.255
    inet6 2001:288:3001:70:205:6bff:fe00:c404  prefixlen 64  scopeid 0x0<global>
    inet6 fe80::205:6bff:fe00:c404  prefixlen 64  scopeid 0x20<link>
    ether 00:05:6b:00:c4:04  txqueuelen 1000  (Ethernet)
    RX packets 5639  bytes 604444 (604.4 KB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 71  bytes 9744 (9.7 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    device interrupt 29  base 0xb000

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    inet 127.0.0.1  netmask 255.0.0.0
    inet6 ::1  prefixlen 128  scopeid 0x10<host>
    loop  txqueuelen 1000  (Local Loopback)
    RX packets 223  bytes 22084 (22.0 KB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 223  bytes 22084 (22.0 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

And here is ping result, if I try to ping Google.com

ping 172.217.168.196
connect: Network is unreachable

The IP address you are trying to access is not in the same subnetwork as the board IP. Have you configured the gateway? This also should be provided by the sysadmin. https://www.cyberciti.biz/faq/linux-setup-default-gateway-with-route-command/
What is the output of route -n?

Mario

Thank you. I solved the issue by flushing all IPs of eth0 and then adding static IP with gateway.