Set Redhat to static IP in VM

Source: Internet
Author: User

In the process of learning arm, because of the need to use SMB and putty, these things are dependent on the IP connection, each boot system IP address will be different, resulting in the need to reconnect each time, it is laborious, so want to set the IP to static, so refer to the information on the Internet to integrate, as follows (leaving only the parts that can be successfully set up and networked, the other parts default):

First, the realization process

Modify the following two files in turn:

/etc/sysconfig/network

/etc/sysconfig/network-scripts/ifcfg-eth0


1./etc/sysconfig/network

NETWORKING=yes
GATEWAY=192.168.1.1  #默认网关

2./etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0  #设备名称
NETMASK=255.255.255.0  #子网掩码
IPADDR=192.168.1.1  #IP地址
BOOTPROTO=static  #【none|static|bootp|dhcp】引导时不使用协议|静态分配|BOOTP协议|DHCP协议
ONBOOT=yes#【yes | no】引导时是否激活设备
DNS1=192.168.1.1  #域名解析服务器,必须加不然无法连接外部网络
PEERDNS=yes

/sbin/ifdown eth0 //如果关闭过程中出现问题,可能是NetworkManager未关闭执行 service NetworkManager stop即可

/sbin/ifup eth0

二、测试过程

1、redhat终端下输入:ifconfig

输出正确的IP信息

ping 192.168.1.x(window系统的ip)

2、windows cmd下输入:ping 192.168.1.102(redhat设定的ip)

以上两者通过表示两个系统能够通信

3、测试网关:测试通过的话redhat能够正常连接外网,不然无法上网

ping 192.168.1.1

Set Redhat to static IP in VM

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.