Linux configuration static IP

Source: Internet
Author: User
Tags nameserver

IP configuration method is to edit sudo nano /etc/network/interfaces

Raspberry Pi Default configuration

Auto Lo
Iface Lo inet Loopback
Iface eth0 inet DHCP


Allow-hotplug Wlan0
Iface Wlan0 inet Manual
Wpa-roam/etc/wpa_supplicant/wpa_supplicant.conf
Iface Default inet DHCP

Methods to modify to static IP

1, the Foreigner's method

sudo vi/etc/network/interfaces


To-change-to-static IP address

Cd/etc/networks

sudo nano interfaces

Replace the line "iface eth0 inet DHCP" with

Iface eth0 inet Static
Address 192.168.1.4
Netmask 255.255.255.0
Gateway 192.168.1.1

Should also take a look at the file /etc/resolv.conf
And check it has a nameserver entry (probably pointing on your default gateway) or direct to your ISP name servers.
NameServer 192.168.1.1

2. Domestic posts

Some friends have been asking if you configure the network, simply write it, hope to help everyone
Http://bbs.shumeipai.org/thread-158-1-1.html

1. Configure the IP address

Edit sudo nano /etc/network/interfaces

Automatically get the configuration of the IP:

auto eth0  
allow-hotplug eth0    
iface eth0 inet dhcp

To configure IP manually:

Auto Eth0
Iface eth0 inet Static
address 192.168.1.7       
netmask 255.255.255.0        
gateway 192.168.0.254

2. Configure DNS

Edit sudo nano/etc/resolv.conf

domain lan
search lan
nameserver 192.168.1.1

Note: nameserver behind the IP is the DNS server, according to their own carrier situation fill it


Computer and Raspberry Pi Cable direct connection

http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=22716

Scenario 1:

On your PC

Address 192.168.1.100
Netmask 255.255.255.0
Gateway 192.168.1.100

On your pi
/etc/network/interface

Address 192.168.1.5
Netmask 255.255.255.0
Gateway 192.168.1.100


Scenario 2:
Rpi
IP 172.16.1.1
Mask 255.255.255.0
Gateway 172.16.1.2//172.16.1.1 Works too


Ubuntu
IP 172.16.1.21
Sub 255.255.255.0
Gateway 172.16.1.1//172.16.1.10 Works too


Scenario 3:
That worked too.

Don ' t set the devices to being gateway for each of the other. All need are something like this:

IP Address of pc:192.168.1.1
IP Address of Rasperberry pi:192.168.1.2
Subnet Mask on both:255.255.255.0
Default Gateway on both:192.168.1.254

Linux configuration static IP

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.