Wednesday, January 8, 2014
How to change Raspberry Pi Dynamic IP to Static IP
1. Checking current network by type command.
cat /etc/network/interfaces
You will see below.
Look at line
iface eth0 inet dhcp
It shown network (eth0) be dhcp.
2. Checking current IP Address by type command.
ifconfig
You will see below.
Look at eth0 you will see.
inet addr:192.168.137.2 Bcast:192.168.137.255 Mask:255.255.255.0
It 's mean.
ip address 192.168.137.2
broadcast 192.168.137.255
netmask 255.255.255.0
3. Checking current gate way type command.
netstat -nr
It will shown.
Look at column Destination and Gateway. It mean.
destination network 192.168.137.0
gateway 192.168.137.1
4. Chang to Static IP
Now you already get current network information enough. If you want to set my IP address to 192.168.1.2. You must editor file /etc/network/interfaces by vi or nano up to you.
sudo vi /etc/network/interfaces
or
sudo nano /etc/network/interfaces
change line
iface eth0 inet dhcp
To be.
iface eth0 inet static
address 192.168.137.2
netmask 255.255.255.0
network 192.168.137.0
broadcast 192.168.137.255
gateway 192.168.137.1
5. Save and reboot
sudo reboot
Now you will connect to Raspberry Pi by IP Address 192.168.1.2
ifconfig
6. Enjoy !
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment