Linux Tutorial Networking
Linux Tutorial Networking
TutorialContents:
l l
OtherYoLinuxNetworkingTutorials:
l
l l l l l l l l l
l l
l l l l
l l
l l l
#Configurationfiles #RedHatLinuxnetworkGUI configurationtools. #AssigninganIPaddress #ActivatingandDeActivatingyourNIC #Subnets #EnableForwarding #Addinganetworkinterfacecard(NIC) #Route #VPN,Tunneling #UsefullLinuxnetworkingcommands #inetd/xinetd:NetworkSocket ListenerDaemons #rwhod:RemoteWhoDaemon #RPC:RemoteProcedureCall. (portmapper) #PAM:NetworkWrappers. #ICMPprotocol. #NetworkMonitoringTools #IDS:IntruderDetectionSystem SNORT #ARP:AddressResolutionProtocol #ConfiguringLinuxForNetwork Multicast #LivinginaMS/Windowsworld #NetworkDefinitions #RelatedLinks
l l
l l l l
Settingupaninternetgatewayforhomeoroffice usingiptables LoadbalancingserversusingLVS(LinuxVirtual Server) Modemdialup: ConfiguringPPPdialupconnectionstoan ISP DialingCompuserve DialingAOL ConfiguringPPPdialinconnections DNSNameserverconfiguration DHCPserverconfiguration:DynamicHost ConfigurationProtocol NISauthenticationconfiguration:ServerandClient Internet/NetworkSecurity SecurityToolsandHackerTools YoLinuxTutorialsIndex
TCP/IPNetworkConfigurationFiles:
l
File: /etc/[Link]
search [Link]'sdomainifusingtheirnameserver nameserver [Link] nameserver [Link]
Notewhenaddinghoststothisfile,placethefullyqualifiednamefirst.(Ithelpssendmailidentifyyourservercorrectly)i.e.:
[Link]
ThisinformsLinuxoflocalsystemsonthenetworkwhicharenothandledbytheDNSserver.(orforallsystemsinyourLAN ifyouarenotusingDNSorNIS)
/usr/sbin/systemconfignetwork
File: /etc/[Link]
hosts:filesdnsnisplusnis
ThisexampletellsLinuxtofirstresolveahostnamebylookingatthelocalhostsfile( /etc/hosts ),thenifthenameisnot foundlooktoyourDNSserverasdefinedby /etc/[Link] andifnotfoundtherelooktoyourNISserver. Inthepastthisfilehashadthefollowingnames:/etc/[Link],/etc/[Link],/etc/[Link],...dependingonthe distribution. FreeInformation Technology Magazine Subscriptions andDocument Downloads
Fedora/RedHatNetworkConfigurationFiles:
l
/etc/sysconfig/network RedHatnetworkconfigurationfileusedbythesystemduringthebootprocess.
ExamplestatementforIntelethernetcard:
[Link] loadablemodule.(defaultforRedHat)
Fedora/RedHatNetworkGUIConfigurationTools:
[Link] andthatdevelopedbyeditingsystemconfigurationfilesdirectly. TCP/IPethernetconfiguration:
l
Networkconfiguration:
/usr/sbin/systemconfignetwork (FC2/3)GUIshownhere> /usr/bin/redhatconfignetwork (/usr/bin/neat)(RH7.2+FC1)
Textconsoleconfigurationtool:
/usr/sbin/systemconfignetworktui (TextUserInterface(TUI)forFedoraCore2/3) /usr/bin/redhatconfignetworktui (RH9.0FC1)
GnomeDesktop:
l
AssigninganIPaddress:
ComputersmaybeassigedastaticIPaddressorassignedonedynamically.
StaticIPaddressassignment:
Chooseoneofthefollowingmethods:
CommandLine:
/sbin/ifconfigeth0192.168.10.12netmask255.255.255.0broadcast192.168.10.255
RedHat/FedoraConsoletools:
Directlyeditconfigurationfiles/[Link].
[Link].(Manuallyaddthe commandstotheendofthefile /etc/rc.d/[Link] toexecutethemuponboot.)Thecommandsnetcfgandnetconfigmake permanentchangestosystemnetworkconfigurationfileslocatedin /etc/sysconfig/networkscripts/ ,sothatthisinformation isretained. TheIANAhasallocatedIPaddressesintherangeof192.168.0.0to192.168.255.255forprivatenetworks. Helpfultools:
l l
NetworkCalculators:Subnetmaskcalculator,nodecalculator,maskinverter,... IPsubnetcalculator
Ubuntu/DebianIPConfigurationFiles:
File: /etc/network/interfaces StaticIPexample:
autolo ifaceloinetloopback autoeth0 ifaceeth0inetstatic address208.88.34.106 netmask255.255.255.248 broadcast208.88.34.111 network208.88.34.104 gateway208.88.34.110
DynamicIP(DHCP)example:
autolo ifaceloinetloopback autoeth0 ifaceeth0inetdhcp autoeth1 ifaceeth1inetdhcp autoeth2 ifaceeth2inetdhcp autoath0 ifaceath0inetdhcp autowlan0 ifacewlan0inetdhcp
RedHat/FedoraCoreIPConfigurationFiles:
TheRedHatconfigurationtoolsstoretheconfigurationinformationinthefile/etc/sysconfig/network . Theywillalsoallowonetoconfigureroutinginformation.
l
ORforDHCPclientconfiguration:
NETWORKING=yes HOSTNAME= myhostnameHostnameisdefinedhereandbycommandhostname
(GatewayisassignedbyDHCPserver.) ORforNISclientconfiguration:
NETWORKING=yes HOSTNAME= myhostnameHostnameisdefinedhereandbycommandhostname NISDOMAIN= NISProject1 NISdomaintoattach
RHEL4/FC3additions: l IPV6INIT=no l USERCTL=no l PEERDNS=yes l TYPE=Ethernet l HWADDR=XX:XX:XX:XX:XX:XX (Usedbyscript /etc/sysconfig/networkscripts/ifup tobringthevariousnetworkinterfacesonline) TodisableDHCPchange BOOTPROTO=dhcp toBOOTPROTO=none Inorderforupdatedinformationinanyofthesefilestotakeeffect,onemustissuethecommand: servicenetworkrestart (or: /etc/init.d/networkrestart )
Changingthehostname:
Thisisathreestepprocess: 1. Issuethecommand: hostnamenewhostname 2. Changenetworkconfigurationfile: /etc/sysconfig/network Editentry: HOSTNAME= newhostname 3. Restartsystemswhichreliedonthehostname(orreboot): Restartnetworkservices: servicenetworkrestart (or: /etc/init.d/networkrestart ) Restartdesktop: n Bringdownsystemtoconsolemode: init3 n BringupXWindows: init5 Onemayalsowanttocheckthefile /etc/hosts foranentryusingthesystemnamewhichallowsthesystemtobeselfaware. Thehostnamemaybechangedatruntimeusingthecommand: [Link]=" superserver "
Selectthe"DNS"tab. Selectthe"Devices"tab+"Edit"+the"General"tab.
NetworkIPaliasing:
AssignmorethanoneIPaddresstooneethernetcard:
ifconfigeth0 [Link].XXXnetmask255.255.255.0broadcast [Link].255 ifconfigeth0:0192.168.10.12netmask255.255.255.0broadcast192.168.10.255 ifconfigeth0:1192.168.10.14netmask255.255.255.0broadcast192.168.10.255 routeaddhost [Link].XXXdeveth0 routeaddhost192.168.10.12deveth0 routeaddhost192.168.10.14deveth0
[Link]:
eth0Linkencap:EthernetHWaddr[Link] inetaddr:[Link]:[Link].255Mask:[Link] UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1
RXpackets:14218errors:0dropped:0overruns:0frame:0 TXpackets:1362errors:0dropped:0overruns:0carrier:0 collisions:1txqueuelen:100 Interrupt:5Baseaddress:0xe400 eth0:0Linkencap:EthernetHWaddr[Link] inetaddr:192.168.10.12Bcast:192.168.10.255Mask:[Link] UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1 Interrupt:5Baseaddress:0xe400 eth0:1Linkencap:EthernetHWaddr[Link] inetaddr:192.168.10.14Bcast:192.168.10.255Mask:[Link] UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1 Interrupt:5Baseaddress:0xe400
Configfile: /etc/sysconfig/networkscripts/ifcfgeth0:0
DEVICE=eth0:0 ONBOOT=yes BOOTPROTO=static BROADCAST=[Link] IPADDR=[Link] NETMASK=[Link] NETWORK=[Link] ONBOOT=yes
DHCPLinuxClient:getconnectioninfo:/sbin/pumpieth0status (RedHatLinux7.1andolder)
Deviceeth0 IP:[Link] Netmask:[Link] Broadcast:[Link].255 Network:[Link].0 [Link].4 Nextserver0.0.0.0 Gateway:[Link].1 Domain:[Link] Nameservers:[Link].3 Renewaltime:SatAug[Link] Expirationtime:SatAug[Link]
ActivatingandDeActivatingyourNIC:
CommandsforstartingandstoppingTCP/IPnetwork servicesonaninterface:
l
Start/Stopnetworkinterfaces
/usr/bin/systemcontrolnetwork (FedoraCore
2/3)
/usr/bin/redhatcontrolnetwork (RH9.0FC1)
l
Subnets:
M A S K
#OFSUB NETS
Slash Fmt
CLASSA HOSTS
CLASSB MASK
CLASS C HOSTS
CLASSC MASK
CLASSCSUB MASK
/32
16,777,214
[Link] 65,534
[Link] 254
[Link]
Invalid 1address Invalid 2addresses 2hosts 4addresses 6hosts 8addresses 14hosts 16addresses 30hosts 32addresses 62hosts 64addresses
[Link]
128 2
/25
[Link]
Binaryposition 8 7 6 5 4321 Value 128 64 32 16 8 4 2 1 Example:192 1 1 0 0 0000 Example192=128+64 [Link]([Link]),[Link],reserved [Link]. SubnetExample: YourISPassignsyouasubnetmaskof255.255.255.248foryouroffice. l 208.88.34.104NetworkBaseaddress l 208.88.34.105Computer1 l 208.88.34.106Computer2 l 208.88.34.107Computer3 l 208.88.34.108Computer4 l 208.88.34.109Computer5 l 208.88.34.110DSLrouter/Gateway l 208.88.34.111Broadcastaddress Oftheeightaddresses,therearesixassignedtohardwaresystemsandultimatelyonlyfiveusableaddresses. Links:
l l l l l
NetworkClasses:
[Link] partofaclassA,B,C,[Link]:
l
ClassC:Definedbythefirst8bitswitharangefrom192223 Firstthreenumbers(24bits)[Link] OneclassBnetworkcandefine254hosts. Range:192.0.0.0223.255.255.255 ClassD:Definedbythefirst8bitswitharangefrom224239 Thisisreservedformulticastnetworks(RFC988) Range:224.0.0.0239.255.255.255 ClassE:Definedbythefirst8bitswitharangefrom240255 Thisisreservedforexperimentaluse. Range:240.0.0.0247.255.255.255
EnableForwarding:
Forwardingallowsthenetworkpacketsononenetworkinterface(i.e. eth0 )tobeforwardedtoanothernetworkinterface(i.e. eth1 ).ThiswillallowtheLinuxcomputertoconect("ethernetbridge")orroutenetworktraffic. Thebridgeconfigurationwillmergetwo(orseveral)[Link] usedtofiltertraffic. ArouterconfigurationcansupportmulticastandbasicIProutingusingthe"route "[Link](NAT)canbe usedtoconnectprivatelocalareanetworks(LAN)totheinternetorloadbalanceservers.
l
Addinganetworkinterfacecard(NIC):
Manualmethod:Thisdoesnotalterthepermanentconfigurationandwillonlyconfiguresupportuntilthenextreboot.
l
Theeasyway:RedHatversions6.2andlater,shipwithKudzu,adevicedetectionprogramwhichrunsduringsystem initialization.(/etc/rc.d/init.d/kudzu)[Link] use/usr/sbin/netconfig [Link] utilizeduponsystemboot. SystemswithtwoNICcards:[Link] definedusingoneofthreemethods: 1. UsetheRedHatGUItool /usr/bin/netcfg OR 2. Definenetworkparametersinconfigurationfiles: Definenewdeviceinfile(RedHat/Fedora) /etc/sysconfig/networkscripts/ifcfgeth1 (S.u.s.e9.2: /etc/sysconfig/network/ifcfgethidXX:XX:XX:XX:XX)
DEVICE=eth1 BOOTPROTO=static IPADDR=[Link] NETMASK=[Link] GATEWAY=[Link] HOSTNAME= [Link] DOMAIN= [Link]
OR 3. DefinenetworkparametersusingUnixcommandlineinterface: DefineIPaddress:
[Link].255 ifconfigeth1192.168.10.12netmask255.255.255.0broadcast192.168.10.255
[Link]. Ifamistakeismadejustrepeattheroutecommandsubstituting"del"inplaceof"add".
ConfiguringyourNIC:SpeedandDuplexsettings:
Thisisusuallynotnecessarybecausemostethernetadapterscanautonegotiatelinkspeedandduplexsetting.
l
ListNICspeedandconfiguration:miitool
eth0:negotiated100baseTxFDflowcontrol,linkok
Verbosemode: miitoolv
eth0:negotiated100baseTxFDflowcontrol,linkok
SetNICconfiguration:miitoolF option Option Parameters F 100baseTxFD 100baseTxHD 10baseTFD 10baseTHD 100baseT4 100baseTxFD 100baseTxHD 10baseTFD 10baseTHD
QueryNICwithethtool: Command
ethtoolgeth0 ethtoolaeth0 ethtoolceth0 ethtoolieth0 ethtooldeth0 ethtoolketh0 ethtoolSeth0
ManPages:
l l
miitoolview,manipulatemediaindependentinterfacestatus ethtoolDisplayorchangeethernetcardsettings
Route:
Staticroutes:IP(InternetProtocol)[Link] toseeifits'[Link],theroutingtableisconsultedto [Link] setwiththe route commandandwiththeconfigurationfile (RedHat/Fedora): /etc/sysconfig/networkscripts/routeeth0 or (RedHat7: /etc/sysconfig/staticroutes ) (S.u.s.e.9.2: /etc/sysconfig/network/routes ):
[Link]/16via192.168.10.254
routeshow/manipulatetheIProutingtable(Staticroute) Examples: Showroutingtable: routee Accessindividualcomputerhostspecifiedvianetworkinterfacecardeth1: routeaddhost123.213.221.231eth1 AccessISPnetworkidentifiedbythenetworkaddressandnetmaskusingnetworkinterfacecardeth0: routeaddnet10.13.21.0netmask255.255.255.0gw192.168.10.254eth0 Conversly: routedelnet10.13.21.0netmask255.255.255.0gw192.168.10.254eth0 Specifydefaultgatewaytousetoaccessremotenetworkvianetworkinterfacecardeth0: routeadddefaultgw201.51.31.1eth0 (Gatewaycanalsobedefinedin /etc/sysconfig/network )
l l
Specifytwogatewaysfortwonetworkdestinations:([Link],[Link] routers/gatewayswillbespecified.) Addinternetgatewayasbefore: routeadddefaultgw201.51.31.1eth0 Addsecondprivatenetwork: routeaddnet10.0.0.0netmask255.0.0.0gw192.168.10.254eth0 [Link]. ipx_routeshow/manipulatetheIPXroutingtableIPXistheNovellnetworkingprotocol(Nottypicallyusedunlessyour officehasNovellservers) ifuserIdentifydestinationsroutedtoaparticularnetworkinterface.
VPN,Tunneling:
l l l l l
l l l l
l l l l
CommercialVPNLinuxsoftwaresolutionsYoLinux [Link] [Link] FreeSWANtutorialhowto OpenVPNSSLVPNsolutionforsitetosite,WiFisecurity,andenterprisescaleremoteaccesswithloadbalancing, failover,andfinegrainedaccesscontrols. SSLExplorerJavaSLLbasedVPN QuaggadynamicroutingsuiteVLAN n2npiertopierwithinaprivatefabric CIPE:CryptoIPEncapsulation(EasiestwaytoconfiguretwoLinuxgatewaysconnectingtwoprivatenetworksoverthe internetwithencryption.) CIPEHomepageCIPEisasimpleencapsulationsystemthatsecurelyconnectstwosubnets. TheLinuxCipe+MasqueradingminiHOWTOAnthonyCiaravalo GRETunnelingGenericRoutingEncapsulationHugoSamayoa [Link] InstallingandRunningPPTPonLinux L2TPExtensions(l2tpext)InternetDrafts.
UsefullLinuxnetworkingcommands:
l l
/etc/rc.d/init.d/networkstart commandtostart,restartorstopthenetwork
l l
l l
l l l l
netstatDisplayconnections,routingtables,statsetc Listexternallyconnectedprocesses: netstatpunta Listallconnectedprocesses: netstatnap Shownetworkstatistics: netstats Kernelinterfacetableinfo: netstataieth0 pingsendICMPECHO_REQUESTpacketstonetworkhosts.UseCntlCtostopping. tracerouteprinttheroutepacketstaketonetworkhost traceroute IPaddressofserver traceroute domainnameofserver mtranetworkdiagnostictoolintroducedinFedoraLiketracerouteexceptitgivesmorenetworkqualityandnetwork [Link]. mtr IPaddressofserver mtr domainnameofserver whoisLookupadomainnameintheinternicwhoisdatabase. fingerDisplayinformationonasystemuser.i.e. finger user@host Uses $HOME/.plan and $HOME/.project userfiles. [Link][Link] iptablesIPfirewalladministration(Linuxkernel2.6/2.4)SeeYoLinuxfirewall/gatewayconfiguration. ipchainsIPfirewalladministration(Linuxkernel2.2)SeeYoLinuxfirewall/gatewayconfiguration. socklistDisplaylistofopensockets,type,port,[Link] fuser orkill . [Link] nslookup ,thehost commandwilluse both /etc/hosts aswellasDNS. Example: host domainnameofserver [Link](YoLinuxTutorial)Note thatnslookupdoesnotusethe /etc/hosts file.
inetd/xinetd:NetworkSocketListenerDaemons:
ThenetworklisteningdaemonslistenandrespondtoallnetworksocketconnectionsmadeontheTCP/IPportsassignedtoit. Theportsaredefinedbythefile /etc/services .Whenaconnectionismade,thelistenerwillattempttoinvoketheassigned [Link] [Link] daemonshavebeenusedinRedHatLinuxdistributions:
l l
inetd:[Link] xinetd:RedHat7.09.0,FedoraCore
inetd:
Configurationfile: /etc/[Link] Entriesinthisfileconsistofasinglelinemadeupofthefollowingfields:
servicesockettypeprotocolwaituserservercmdline
l l
l l
service:[Link] /etc/services sockettype: stream:connectionprotocols(TCP) dgram:datagramprotocols(UDP) raw rdm seqpacket protocol:Transportprotocolnamewhichmatchesanameinthefile /etc/protocols .[Link],icmp,tcp,rpc/udp, rpc/tcp,ip,ipv6 wait:Appliesonlytodatagramprotocols(UDP). wait[.max]:Oneserverforthespecifiedportatanytime(RPC) nowait[.max]:Continuetolistenandlaunchnewservicesifanewconnectionismade.(multithreaded) Maxreferstothemaximumnumberofserverinstancesspawnedin60seconds.(default=40) user[.group]:[Link],rootoraspecialrestrictedidforthat service. server:Fullpathnameoftheserverprogramtobeexecuted. cmdline:Commandlinetobepassedtotheserver.Thisincludesargument0(argv[0]),thatisthecommandname. [Link]:echo,discard,chargen(character generator),daytime(humanreadabletime),andtime(machinereadabletime).(seeRFC)
SampleFile: /etc/[Link]
#echostreamtcpnowaitrootinternal #echodgramudpwaitrootinternal ftpstreamtcpnowaitroot/usr/sbin/[Link] la #pop3streamtcpnowaitroot/usr/sbin/tcpdipop3d #swatstreamtcpnowait.400root/usr/sbin/swatswat
xinetd:ExtendedInternetServicesDaemon:
Xinetdhasaccesscontrolmachanisms,loggingcapabilities,theabilitytomakeservicesavailablebasedontime,andcan placelimitsonthenumberofserversthatcanbestarted,redirectservicestodifferentportsandnetworkinterfaces(NIC)or eventoadifferentserver,chrootaserviceetc...andthusaworthyupgradefrominetd. Usethecommand chkconfiglist [Link] controlledbyxinetdandtheirrespectivestateunderthetitle"xinetdbasedservices".(Worksforxinetd(RH7.0+)butnot inetd) ThexinetdnetworkdaemonusesPAMalsocallednetworkwrapperswhichinvokethe /etc/[Link] and/etc/[Link] files. Configurationfile: /etc/[Link] whichinturnusesconfigurationfilesfoundinthedirectory /etc/xinetd.d/ . Toturnanetworkserviceonoroff:
l
Editthefile /etc/xinetd.d/servicename Setthedisablevalue: disable=yes or disable=no Restartthexinetdprocessusingthesignal: SIGUSR1( killSIGUSR1processid )Softreconfigurationdoesnotterminateexistingconnections. (Importantifyouareconnectedremotely) SIGUSR2Hardreconfigurationstopsandrestartsthexinetdprocess. (Note:UsingtheHUPsignalwillterminatetheprocess.) OR
Thefilecontainsentriesoftheform:
serviceservicename { attributeassignmentoperatorvaluevalue... ... {
Where: l attribute: disable: n yes n no type: n RPC n INTERNAL: n UNLISTED:Notfoundin /etc/rpc or /etc/services id:Bydefaulttheserviceidisthesameastheservicename. socket_type: n stream:TCP n dgram:UDP n raw:DirectIPaccess n seqpacket:servicethatrequiresreliablesequentialdatagramtransmission flags:Combinationof: REUSE,INTERCEPT,NORETRY,IDONLY,NAMEINARGS,NODELAY,DISABLE,KEEPALIVE, NOLIBWRAP . Seethexinetdmanpagefordetails. protocol:Transportprotocolnamewhichmatchesanameinthefile /etc/protocols . wait: n no:multithreaded n yes:singlethreadedOneserverforthespecifiedportatanytime(RPC) user:Seefile: /etc/passwd group:Seefile: /etc/group server:Programtoexecuteandrecievedatastreamfromsocket.(Fullyqualifiednamefullpathenameof program) server_args:Unlikeinetd,arg[0]orthenameoftheserviceisnotpassed. only_from:IPaddress,factorizedaddress,netmaskrange,hostnameornetworknamefrom file /etc/networks . no_access:Denyfrom...(inverseofonly_from) access_times port:Seefile /etc/services Also:log_type,log_on_success,log_on_failure(Logoptions:+=PID,HOST,USERID,EXIT,DURATION,ATTEMPT andRECORD),rpc_version,rpc_number,env,passenv,redirect,bind,interface,banner,banner_success, banner_fail,per_source,cps,max_load,groups,enabled,include,includedir,rlimit_as,rlimit_cpu,rlimit_data, rlimit_rss,rlimit_stack. Thebestsourceofinformationisthemanpageanditsmanyexamples. l assignmentoperator: = +=:addavaluetothesetofvalues =:deleteavaluefromthesetofvalues Thenrestartthedaemon: /etc/rc.d/init.d/xinetdrestart Examplefrommanpage:Limittelnetsessionsto8Mbytesofmemoryandatotal20CPUsecondsforchildprocesses.
servicetelnet { socket_type=stream wait=no nice=10 user=root server=/usr/etc/[Link] rlimit_as=8M rlimit_cpu=20 }
Formoreinfosee:
l l l l l
RWHO:RemoteWhodaemonrwhod
The"rwho "commandisusedtodisplayusersloggedintocomputersonyourLAN. Bydefault,[Link]" rwho ",youwillonly [Link] [Link] rwhod onalocal privateandfirewallprotectednetwork,hereishow: [Link] /etc/init.d/rwhod changefrom: daemonrwhod to:daemonrwhodb Startservice:
l l
Manpages:
l l l
RPC:RemoteProcedureCalls(Portmapper)
PortmpperisanetworkservicerequiredtosupportRPC'[Link](filesharingservices)require portmapper. ListRPCservicessupported: [root]#rpcinfoplocalhost Startingportmapserver:
l l
ManPages:
l l l l
PAM:NetworkWrappers:
PluggableAuthenticationModulesforLinux(TCPWrappers) [Link]. File:/etc/[Link]
[Link]:[Link]
l l
Modules:
l l l l
Wietse'sPapers PluggableAuthenticationModulesforLinux(PAM)HomePage
ICMP:
ICMPisthenetworkprotocolusedbythe ping and traceroute commands. [Link],addthe followinglineto /etc/[Link] :
[Link].accept_redirects=1
Addthefollowingtothefile: /etc/rc.d/[Link]
forfin/proc/sys/net/ipv4/conf/*/accept_redirects
do echo1>$f done
BlockingICMPandlookinvisibletoping:
ThefollowingfirewallruleswilldropICMPrequests. Iptables:
iptablesAOUTPUTpicmpd0/0jDROP
Ipchains:
ipchainsAoutputpicmpd0/0jDENY
ORdropallincommingpings:
echo1>/proc/sys/net/ipv4/icmp_echo_ignore_all
ThisissometimesnecessarytolookinvisibletoDOS(DenialOfService)attackerswhousepingtowatchyourmachineand launchanattackwhenit'spressenceisdetected
NetworkMonitoringTools:
l
[Link]. Commandlineoption Description c C i wfilename n t Filterexpressions: primitive hosthostname Exitafterreceivingcountpackets. Specifysizeofoutputdumpfiles. [Link].i.e.eth0 Writetherawpacketstofileratherthanparsingandprintingthemout. Theycanlaterbeprintedwiththeroption. [Link]. Don'tprintatimestamponeachdumpline.
Description IfhosthasmultipleIP's,allwillbechecked.
Networknumber. netnetworknumber networknumbermaskmask Networknumberandnetmaskspecified. net port portnumber tcp udp icmp Examples:
l l l l
iptrafInteractiveColorfulIPLANMonitor nmapNetworkexplorationtoolandsecurityscanner Listpingablenodesonnetwork: nmapsP192.168.0.0/24 ScansnetworkforIPaddresses192.168.0.0to192.168.0.255usingping. [Link]. RPM'srequired: l ethereal0.8.152.i386.rpmRedHat7.1PowertoolsCDRPM l ucdsnmp4.212.i386.rpmRedHat7.1binaryCD1 l ucdsnmputils4.212.i386.rpmRedHat7.1binaryCD1 l Also:gtk+,glib,glibc,XFree86libs4.0.35(baseinstall)
l l l
l l
l l l l
Thereisanerrorintheetherealpackagebecauseitdoesnotshowthesnmplibrariesasadependancies,butyou candeducethisfromtheerrorsthatyougetiftheucdsnmplibrariesarenotinstalled. [Link] coolgraphics.(RedHatPowertoolsCD7.1) [Link].(RedHatPowertoolsCD) IPTrafncursesbasedIPLANmonitor.(RedHatPowertoolsCD) CheopsNetworkdiscovery,location,[Link] yournetwork,theirIPaddress,theirDNSname,[Link] systemonyournetwork.(RedHatPowertoolsCD) [Link] receivedonyournetwork.(RedHatPowertoolsCD) MRTGMultiRouterTrafficGrapherMonitornetworktrafficloadusingSNMPandgenerateanHTML/GIFreport.(See sampleoutput) [Link]. [Link],ICMP,DNS,HTTP,SUNRPC, NTP,&UDP.(RedHatPowertoolsCD) BigBrotherMonitoringansservicesavailablility. [Link]. Nagioshost,serviceandnetworkmonitoring Angelnetworkmonitor
Usingtcpdumptomonitorthenetwork:
[root]#ifconfigeth0promiscPutnicintopromiscuousmodetosnifftraffic. [root]#tcpdumpnhostnot [Link]|moreSniffnetbutignoreIPwhichisyourremotesession. [root]#ifconfigeth0promiscPullnicoutofpromiscuousmode.
NetworkIntrusionandHackerDetectionSystems:
SNORT:Monitorthenetwork,performingrealtimetrafficanalysisandpacketloggingonIPnetworksforthedetectionofan attackorprobe.
l l
LinuxJournal:PlanningIDSforYourEnterpriseNalneeshGaur [Link].
ARP:AddressResolutionProtocol
EthernethostsusetheAddressResolutionProtocol(ARP)toconverta32bitinternetIPaddressesintoa48bitEthernetMAC addressusedbynetworkhardware.(See:RFC826)ARPbroadcastsaresenttoallhostsonthesubnetbythedatatransmitting [Link]. TheMACaddressesareremembered(APRcache)[Link] [Link]. ReverseARP(See:RFC903)isabootstrapprotocolwhichallowsaclienttobroadcastrequestingaservertoreplywithitsIP address.
l l l l l l
l l
arp(8)manpagemanipulatethesystemARPcache Showsothersystemsonyournetwork(includingIPaddressconflicts): arpa ShowARPtableLinuxstyle: arpe arpwatch(8)manpagekeeptrackofethernet/ipaddresspairings arpsnmp(8)manpagekeeptrackofethernet/[Link] arping(8)manpagesendARPREQUESTtoaneighborhost PrintARPreply(similarto arpa):arping [Link] ListARPtable: cat/proc/net/arp ip(8)manpageshow/manipulaterouting,devices,policyroutingandtunnels ViewARPtable: ipneighbor
[Link]'[Link] aforementionedinformationisjustpartoftheLinuxcultureoffullvisibilityintowhatisgoingon.
ConfiguringLinuxForNetworkMulticast:
[Link](TCP/IP),email SNMP(TCP/IP),DNS(UDP),FTP(TCP/IP),...[Link],audioor datastreamtomultiplenodeswithonetransmissionstreaminsteadofmultipleindividualpeertopeerconnections,oneforeach node,[Link] messagesareonly"heard"bythenodesonthenetworkthathave"joinedthemulticastgroup"whicharethosethatareinterested
Description [Link]"InternetGroupManagement Protocol". (See /usr/src/linux/net/core/igmp.c ) Listmulticastinterfaces. (See /usr/src/linux/net/core/dev_mcast.c ) AllhostsconfiguredformulticastwillrespondwiththeirIPaddresses Allroutersconfiguredformulticastwillrespond AllPIMroutersconfiguredformulticastwillrespond AllDVMRProutersconfiguredformulticastwillrespond AllOSPFroutersconfiguredformulticastwillrespond
routeadd224.0.0.0netmask240.0.0.0deveth0
LivinginaMS/WindowsWorld:
l
LinNeighborhoodHomePage
LinNeighborhoodHomePage LinNeighborhoodScreenShot
SeetheYoLinuxtutorialonintegratingLinuxintoaMicrosoftnetwork.
NetworkDefinitions:
l
l l l
IPv4:MostoftheInternetserversandpersonalcomputersuseInternetProtocolversion4(IPv4).Thisuses32bitsto [Link] representationoffour8bitnumbersthustotaling32bits. IPv6:InternetProtocolversion6(IPv6)[Link] protocolhasalsobeenupgradedtoincludenewqualityofservicefeaturesandsecurity.CurrentlyLinuxsupportsIPv6but IPv4isusedwhenconnectingyourcomputertotheinternet. TCP/IP:(TransmissionControlProtocol/InternetProtocol)[Link] definesthedatapacketstransmitted(packetheader,datasection),dataintegrityverification(errordetectionbytes), connectionandacknowledgementprotocol,andretransmission. TCP/IPtimetolive(TTL):Thisisacountingmechanismtodeterminehowlongapacketisvalidbeforeitreachesits [Link]/[Link] [Link] network. MACAddress:(mediaaccesscontrol)isthenetworkcardaddressusedforcommunicationbetweenothernetwork [Link]/IPaddress(globalinternet)tothelocalhardware [Link] /sbin/ifconfig [Link] addressuniquelyidentifieseachnodeofanetworkandisusedbytheEthernetprotocol. FullDuplex:[Link]. HalfDuplex:Allowsthesendingandreceivingofpacketsinonedirectionatatimeonly. OSI7LayerModel:TheISO(InternationalStandardsOrganization)hasdefinedtheOSI(OpenSystemsInterconnection) modelforcurrentnetworkingprotocols. OSILayer Description LinuxNetworkingUse 7 6 5 4 3 2 1 ApplicationLayer. telnet,webbrowser,sendmail Thetoplayerforcommunicationsapplicationslikeemailandtheweb. PresentationLayer. Syntaxandformatofdatatransfer. SessionLayer. TransportLayer. Connection,acknowledgementanddatapackettransmission. NetworkLayer. DataLinkLayer. Errorcontrol,timing SMTP,http
RelatedLinks:
l l l l l l l l l
l l l l
CablemodemHowToVladimirVuksan EthernetHowToPaulGortmaker YoLinuxTutorial:Settingupaninternetgatewayforhomeorofficeusingiptablesoripchains FirewallHowToMarkGrennan YoLinuxnetworkingtutorial NetworkingOverviewHowToDanielLopezRidruejo NetworkingHowtoJoshuaDrake NFSHowtoNicolaiLangfeldt SNMP:SimpleNetworkManagementProtocol(Usesports161,162,391,1993) SNMPIntroandtutorials LinuxSNMPNetworkManagementTools SNMPFAQ netsnmptoolsandlibraries News/UsenetGroup:[Link] MARSnweNetwareemulator Linux2.4AdvancedRoutingHOWTOiproute2,trafficshapingandabitofnetfilter ISDN: ISDN4LINUXFAQMatthiasHessler
l l
ISDN4LinuxHomePage DanKegel'sISDNPage PPP:PointtoPointProtocol YoLinuxTutorial:ConfiguringPPPdialupconnectionstoanISP YoLinuxTutorial:DialingCompuserve YoLinuxTutorial:DialingAOL YoLinuxTutorial:ConfiguringPPPdialinconnections PPTP:PointtoPointTunnelingProtocol RFC2637:PointtoPointTunnelingProtocol(PPTP). [Link].S. Ananian. CounterpaneSystemsFAQonMicrosoft'sPPTPImplementationFAQonthesecurityflawsinMicrosoft'sPPTP Implementation. DHCP:(DynamicHostConfigurationProtocol) YoLinuxDHCPTutorialHowtosetupaDHCPserver. ISCDynamicHostConfigurationProtocolDHCPhomepage Multicast: YoLinuxTutorial:ConfiguringLinuxformulticastthistutorialinsectionabove MulticastoverTCP/IPHOWTO ISP's:(National/Global) [Link]'s Earthlink Concentric ATTWorldnet NIS:(NFSinfrastructure) YoLinuxNIStutorial NIShowto NISconfigurationanduse Ethernetcables: MakingCAT3,5,5ERJ45EthernetCables WiringandInstallation GigabitEthernet VIX:ViennaInterneteXchangeEuropeantrafficexchangeforISP's
TestInternetBandwidth:
l l l l l
ManPages:
l l l l l
Books:
"NetworkingLinux:APracticalGuidetoTCP/IP" byPatEyler ISBN#0735710317,NewRidersPublishing
"AdvancedLinuxNetworking"
[Link] ISBN#0201774232,AddisonWesleyProfessional1stedition(July15,2002)
"RedHatLinux9Unleashed" byBillBall,HoytDuff Sams,ISBN#0672325888 [Link] [Link] [Link]"Unleashed"serieshavedissapointed me,thisbookisthebestoutthere. "RedhatLinux9(VisualQuickProGuide)" byHaroldDavis ISBN#032121918X,PeachpitPress,AddisonWesley [Link] describedasaguidetousingtheGUIconfigurationtools.