Vous êtes sur la page 1sur 7

Home(/)Articles(/articles)Linux(/articles/linux)

Here

LinuxNetworkConfiguration
ThisarticlecoversnetworkconfigurationonLinux,
withspecificreferencetotheinformationneededfor
theRHCSAEX200

(http://www.redhat.com/training/courses/ex200/examobjective)andRHCEEX300
(http://www.redhat.com/training/courses/ex300/examobjective)certificationexams.

Remember,theexamsarehandson,soitdoesn'tmatterwhichmethodyouusetoachievethe
result,solongastheendproductiscorrect.

NetworkingFiles
systemconfignetworktui
NetworkConnections

Relatedarticles.

NICChannelBondinginRHEL5&6(CentOS&OracleLinux)(nicchannelbonding)
RoutingIPTrafficonLinux(routingiptrafficonlinux)
UseiptablestoImplementPacketFilteringandConfigureNetworkAddressTranslation(NAT)
(useiptablestoimplementpacketfilteringandconfigurenat)

NetworkingFiles
The"/etc/sysconfig/network"fileholdstoplevelnetworkingconfiguration,includingthehostname
andgatewaysettings.

#cat/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=rhce1.localdomain
GATEWAY=192.168.122.1
#

The"/etc/sysconfig/networkscripts/ifcfgeth0"fileholdsthenetworkconfigurationforthe"eth0"
adapter.Ifyouhavemultiplenetworkadapters,youwouldexpectadditionalconfigurationfiles(eth1,
eth2etc.).ThefollowingexamplecontainstheconfigurationforaDHCPadapter.
#cat/etc/sysconfig/networkscripts/ifcfgeth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="Systemeth0"
UUID=5fb06bd00bb07ffb45f1d6edd65f3e03
HWADDR=52:54:00:91:6A:B3
PEERDNS=yes
PEERROUTES=yes
#

ThefollowingexampleisforastaticIPaddress.

#cat/etc/sysconfig/networkscripts/ifcfgeth0
DEVICE=eth0
NM_CONTROLLED=yes
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="Systemeth0"
UUID=5fb06bd00bb07ffb45f1d6edd65f3e03
HWADDR=52:54:00:91:6a:b3
PEERROUTES=yes
IPADDR=192.168.122.89
NETMASK=255.255.255.0
GATEWAY=192.168.122.1
DNS1=192.168.122.1
USERCTL=no
#

The"/etc/hosts"filecontainsinformationforlocalnameresolution.

#cat/etc/hosts
127.0.0.1localhostlocalhost.localdomainlocalhost4localhost4.localdomain4
192.168.122.89rhce1.localdomainrhce1
#
The"/etc/resolv.conf"fileisusedtoconfigurethelocationoftheDNSserverstobeusedforname
resolution.Therecanbemultiple"nameserver"lines,oneforeachnameserver.

#cat/etc/resolv.conf
#GeneratedbyNetworkManager
searchlocaldomain
nameserver192.168.122.1
#

The"/etc/sysconfig/networkscripts"directorycontainsanumberofnetworkrelatedscriptsand
commands.The ifdown and ifup commandsareusedtostopandstartthespecifiednetwork
adapters.

#ifdowneth0
Devicestate:3(disconnected)
#ifupeth0
Activeconnectionstate:activated
Activeconnectionpath:/org/freedesktop/NetworkManager/ActiveConnection/5
#

Thecurrentnetworksettingsaredisplayedusingthe ifconfig command.

#ifconfiga
eth0Linkencap:EthernetHWaddr52:54:00:91:6A:B3
inetaddr:192.168.122.89Bcast:192.168.122.255Mask:255.255.255.0
inet6addr:fe80::5054:ff:fe91:6ab3/64Scope:Link
UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1
RXpackets:13548errors:0dropped:0overruns:0frame:0
TXpackets:6144errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:1000
RXbytes:2871500(2.7MiB)TXbytes:824754(805.4KiB)
Interrupt:11Baseaddress:0xe000

loLinkencap:LocalLoopback
inetaddr:127.0.0.1Mask:255.0.0.0
inet6addr:::1/128Scope:Host
UPLOOPBACKRUNNINGMTU:16436Metric:1
RXpackets:48errors:0dropped:0overruns:0frame:0
TXpackets:48errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:0
RXbytes:3230(3.1KiB)TXbytes:3230(3.1KiB)

#

systemconfignetworktui
The systemconfignetworktui and systemconfignetwork commandsstartatextbased
networkconfigurationtool.

Navigateusingthe"tab","arrow"and"return"keys.The"Deviceconfiguration"optiongivesalistof
networkdevices.

Translate

Selectingthedeviceallowsyoutoedittheadapter'snetworkconfiguration,whichissavedtothe
"/etc/sysconfig/networkscripts/ifcfgeth0"file.
The"DNSconfiguration"optiononthefirstscreenallowsyoutomodifytheconfigurationinthe
"/etc/sysconfig/network"and"/etc/resolv.conf"files.

Translate

Thenetworkconfigurationcanalsobeinitiatedusingthe setup command.

NetworkConnections
The"NetworkConnections"dialogisavailablefromthemenu(System>Preferences>Network
Connections)attheconsole.
Highlightingthedeviceandclickingthe"Edit"buttonallowsyoutovieworaltertheconfigurationof
adevice.

Translate

Formoreinformationsee:

RHEL6Documentation(https://access.redhat.com/site/documentation/en
US/Red_Hat_Enterprise_Linux/)
Linuxmanpages(http://linux.die.net/man/)
RHCSAandRHCE(articleslinux#rhcsa_and_rhce)
NICChannelBondinginRHEL5&6(CentOS&OracleLinux)(nicchannelbonding)
RoutingIPTrafficonLinux(routingiptrafficonlinux)
UseiptablestoImplementPacketFilteringandConfigureNetworkAddressTranslation(NAT)
(useiptablestoimplementpacketfilteringandconfigurenat)

Hopethishelps.RegardsTim...

BacktotheTop.

4comments,read/addthem...(/misc/comments?page_id=1067)

Home(/)|Articles(/articles/articles)|Scripts(/dba/scripts)|Blog(/blog/)|Certification(/misc/ocp
certification)|Misc(/misc/miscellaneous)|About(/misc/siteinfo)

AboutTimHall(/misc/siteinfo#biog)
Copyright&Disclaimer(/misc/siteinfo#copyright)

Translate

Vous aimerez peut-être aussi