Linux Basics-Network settings

Source: Internet
Author: User

Linux files that store network interface information and MAC address correspondence

Redhat 5:/etc/modprobe.conf

Redhat 6:/etc/udev/rules/70-persistent-net.rules


Temporarily Configure IP address information

Ifconfig

Ifconfig EthX Ip/mask [Up|down]

Ifconfig ethx:x Ip/mask [Up|down] Add multiple addresses under the same NIC

The configured address takes effect immediately, but fails when the network or host is restarted


#永久配置IP地址信息

Network configuration file

/etc/sysconfig/network

Network Interface configuration file

/etc/sysconfig/network-scripts/ifconfig-name

Device= "eth0" #设备名称 to match the name of the filename bootproto= "DHCP" #引导协议 {static|none|dhcp|boottp}, static: Static|nonenm_controlled= "Yes "#是否启用netwokmanagerONBOOT =" yes "#开机时是否自动启动TYPE =" Ethernet "#IPADDR =" "#IP地址NETMASK =" "#子网掩码GATEWAY =" "#默认网关HWADDR = "" #MAC地址, Userctl={yes|no} #是否允许普通用户控制此接口PEERDNS ={yes|no} can be omitted #是否在BOOTPROTO为dhcp是接受由dhcp服务器指定的DNS地址

/etc/sysconfig/network-scripts/ifconfig-ethx:x

Permanently add multiple addresses under one NIC



Network Services

redhat:/etc/init.d/network {Start|stop|restart|status}


#临时配置路由信息

Gateway Settings

Route

Add: Adding routes

-host: Adding host routes

-net: Adding network routes

-net 0.0.0.0

Route add-net|-host DEST GW Nexthop

Route add default GW nexthop

Del: Delete route

-host: Removing host routes

-net: Deleting network routes

Route Del-net 10.0.0.0/8

The configured address takes effect immediately, but fails when the network or host is restarted


#永久配置路由信息

/etc/sysconfig/network-scripts/route-ethx

Add format one:

Target network via next hop

Add format two:

address0=

netmask0=

gateway0=


/etc/sysconfig/network

Networking=yes #是否启用网络功能NETWORKING_IPV6 =yes #是否启动ipv6网络功能HOSTNAME =localhsot.localhost #主机名配置GATEWAY = #全局网关地址


IPROUTE2 module: A powerful IP management module

Command: IP

Link: Network Interface properties

Ip-s Link Show: View NIC interface information

IP Link set interface {up|down} enabled | Shutdown interface

Addr: Protocol Address

Route

IP route add to 10.0.0.0/8 Dev eth0 via 172.16.0.1

IP route flush to 10/8 clears the 10.0.0.0/8 route




This article from "Liang Childe" blog, please be sure to keep this source http://iyull.blog.51cto.com/4664834/1887100

Linux Basics-Network settings

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.