Comparison of Redhat and Ubuntu Nic configuration methods

Source: Internet
Author: User
Tags nameserver
Article title: Comparison of Redhat and Ubuntu Nic configuration methods. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Set a fixed ip address for the NIC in Redhat linux

Previously, the redhat-config-network setting of the NIC fixed ip address in xwindow did not work. after the redhat-config-network is set, the ping fails. Check some information, change/etc/sysconfig/network-scripts/ifcfg-eth0 (the first Nic is eth0), configure the dns file as/etc/resolv. conf, I keep the dhcp configuration. After configuration, use ifconfig eth0 down; ifconfig eth0 up. The following is a configuration file list:

#/Etc/sysconfig/network-scripts/ifcfg-eth0:

DEVICE = eth0

BOOTPROTO = static

BROADCAST = 192.168.1.255

IPADDR = 192.168.1.10

NETMASK = 255.255.255.0

NETWORK = 192.168.1.0

HWADDR = 52: 54: AB: 2F: CF: F0

GATEWAY = 192.168.1.1

ONBOOT = on

TYPE = Ethernet

#/Etc/resolv. conf

Nameserver 202.109.14.5

Nameserver 202.96.209.5

Search localdomain

Or run the following command: setup

Or:

Route add-net 192.168.1.50 netmask 255.255.255.0 dev eth0

Or:

Ifconfig eth0 192.168.1.50 netmask 255.255.255.0

Ubuntu Nic settings, ip, mask, gateway, dns

Sudo vi/etc/network/interfaces

// This should determine whether to enable this port

Auto eth0

// Set the IP address statically

Iface eth0 inet static

Address 172.16.146.200

Netmask 255.255.255.0

# Broadcast 172.16.146.255

Gateway 172.16.146.254

// Dynamic settings through dhcp

Iface eth0 inet dhcp

// Set the DNS server

Sudo vi/etc/resolv. conf

Nameserver 202.96.128.68

Nameserver 61.144.56.101

Nameserver 192.168.8.220

// Reset the network to enable the new settings

Sudo/etc/init. d/networking restart

// OK

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.