Linux basic configurations - basic network http://basicconfig.com/taxonomy/term/14 en Install and using Lynx web browser in Ubuntu http://basicconfig.com/linuxnetwork/lynx_browser_ubuntu <!-- google_ad_section_start --><div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p>In Ubuntu, you can also surf the Internet or view website in command line terminal. The great browser for command line terminal is <b>Lynx</b>. Lynx package is not install by default. Installing lynx package in Ubuntu is very easy using apt package management system if you already have an Internet connection.</p> <p>Here is an example on how to install lynx with apt-get:</p> <table><tr><td><code>luzar@ubuntu:~$ sudo apt-get install lynx<br /> [sudo] password for luzar:<br /> Sorry, try again.<br /> [sudo] password for luzar:<br /> Reading package lists... Done<br /> Building dependency tree<br /> Reading state information... Done<br /> The following NEW packages will be installed:<br /> lynx<br /> 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.<br /> Need to get 1168kB of archives.<br /> After this operation, 4997kB of additional disk space will be used.<br /> Get:1 http://us.archive.ubuntu.com hardy/main lynx 2.8.6-2ubuntu2 [1168kB]<br /> Fetched 1168kB in 1min39s (11.8kB/s)<br /> Selecting previously deselected package lynx.<br /> (Reading database ... 18984 files and directories currently installed.)<br /> Unpacking lynx (from .../lynx_2.8.6-2ubuntu2_i386.deb) ...<br /> Setting up lynx (2.8.6-2ubuntu2) ...<br /></code></td> </tr></table><p>Now that lynx is successfully installed in our system, let's try open a website:</p> <table><tr><td><code>luzar@ubuntu:~$ lynx -accept_all_cookies http://www.google.com<br /></code></td> </tr></table><p><a href="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/lynx.png" title="Image" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/thumbs/lynx.png" alt="example of lynx opening a website screenshot" /></a></p> <p>In the example above, the option <b> -accept_all_cookies</b> will always accept cookies from website we are going to open. We use this option just avoid answering the question lynx will ask later. Certain web server need us to accept cookies before allowing us to view the website.</p> <p>There are more options that you use with lynx web browser. Here is some options from lynx manual page:</p> <table><tr><td><code> -accept_all_cookies<br /> accept all cookies.<br /><br /> -anonymous<br /> apply restrictions for anonymous account, see also -restrictions.<br /><br /> -assume_charset=MIMEname<br /> charset for documents that donât specify it.<br /><br /> -assume_local_charset=MIMEname<br /> charset assumed for local files, i.e., files which lynx creates such as internal<br /> pages for the options menu.<br /><br /> -assume_unrec_charset=MIMEname<br /> use this instead of unrecognized charsets.<br /><br /> -auth=ID:PASSWD<br /> set authorization ID and password for protected documents at startup. Be<br /> sure to protect any script files which use this switch.<br /><br /> -base<br /> prepend a request URL comment and BASE tag to text/html outputs for -source<br /> dumps.<br /><br /> -bibp=URL<br /> specify a local bibp server (default http://bibhost/).<br /><br /> -blink<br /> forces high intensity background colors for color mode, if available and<br /> supported by the terminal. This applies to the slang library<br /> (for a few terminal emulators), or to OS/2 EMX with ncurses.<br /><br /> -book<br /> use the bookmark page as the startfile. The default or command line<br /> startfile is still set for the Main screen command, and will be used<br /> if the bookmark page is unavailable or blank.<br /><br /> -buried_news<br /> toggles scanning of news articles for buried references, and converts them to<br /> news links. Not recommended because email addresses enclosed in angle<br /> brackets will be converted to false news links, and unencoded messages<br /> can be trashed.<br /><br /> -cache=NUMBER<br /> set the NUMBER of documents cached in memory. The default is 10.<br /><br /> -case<br /> enable case-sensitive string searching.<br /><br /> -center<br /> Toggle center alignment in HTML TABLE.<br /><br /> -cfg=FILENAME<br /> specifies a Lynx configuration file other than the default lynx.cfg.<br /><br /> -child exit on left-arrow in startfile, and disable save to disk.<br /></code></td> </tr></table><p>The lynx usage menu is available at the bottom of lynx browser. See an example picture below:</p> <p><a href="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/lynx_usage.png" title="Image" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/thumbs/lynx_usage.png" alt="Lynx usage menu screenshot" /></a></p> <p>Lynx will preview one page at a time. If you are viewing a large page, press space bar to view next page. You can also use Up and Down key to move the cursor but only to the next link. For example, when you press down key, it will move to the next link available in the page. </p> <p>The left and right arrow key has a function too. The right key will open or follow a link. You can go back to previous page with left key. That's easy, isn't it? Ok, if you feel dizzy already with my explanation, press q and enter to quit lynx.</p> </div></div></div><!-- google_ad_section_end --><div class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above"><div class="field-label">Tags:&nbsp;</div><div class="field-items"><div class="field-item even" rel="dc:subject"><a href="/taxonomy/term/7" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">linux tutorials</a></div><div class="field-item odd" rel="dc:subject"><a href="/taxonomy/term/14" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">basic network</a></div></div></div> Fri, 12 Dec 2008 02:41:38 +0000 jinlusuh 115 at http://basicconfig.com http://basicconfig.com/linuxnetwork/lynx_browser_ubuntu#comments Introduction to Linux networking http://basicconfig.com/linuxnetwork <!-- google_ad_section_start --><div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p>This is a Linux networking section. Users have learned how to install Linux, practising a few basic Linux commands which enabled them to manage Linux system in the previous Linux basics and Linux administration tutorials. Here in the Linux networking section, user will be exposed to what Linux is all about, serving network.</p> <p>As you know, Linux itself is just a kernel. Linux can be configured as a networked workstation, a DNS server, a DHCP server, a web server, a mail server, a file and print server, database server, a firewall, a gateway router and many more. Is Linux can be all that? Yes it can. In this section, user will learn the true meaning of Linux, which is a network operating system or server system, to be all that mention above.</p> <p>The first thing you should learn about networking is ip addresses. A server and a client computer must have an ip address so that it can be reach in network environment. Learn about Linux ip address in <a href="/linuxnetwork/networking" target="_blank">Linux networking - ip address and subnet mask</a> tutorial here.</p> <p>Linux server can serves networking 365 days a year without any problem. It's a proof that Linux is a very stable and secure network operating system when properly configured and maintained. All that starts with setting up a network card and configure an ip address for the server. The <a href="/linuxnetwork/ethernet" target="_blank"> Linux networking - Installing Ethernet card</a> tutorial is a guide on how to install Ethernet card in Linux computer.</p> <p>You already learned about ip address and installing a network interface card, now it's time to configure Linux ip address. Here is a guide on how to <a href="/basicnetwork" target"_blank">Setup Slackware Ethernet ip address</a>.</p> <p>During this period of learning, understanding of Linux command structure and syntax is necessary. Setting up and configuring Linux network requires testing and troubleshooting. You might encounter errors, which is most likely, and try to troubleshoot by analysing error log files. You can learn and practice Linux network commands in <a href="/linuxnetwork/netcmd">Linux network commands</a> tutorial.</p> </div></div></div><!-- google_ad_section_end --><div class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above"><div class="field-label">Tags:&nbsp;</div><div class="field-items"><div class="field-item even" rel="dc:subject"><a href="/taxonomy/term/14" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">basic network</a></div></div></div> Sat, 20 Sep 2008 13:50:20 +0000 jinlusuh 67 at http://basicconfig.com http://basicconfig.com/linuxnetwork#comments netstat command tutorial http://basicconfig.com/linuxnetwork/netstat <!-- google_ad_section_start --><div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p>Linux netstat command is another useful network utility in Linux. We can use netstat to list network connections, view routing table and information about network interface. The netstat command has been one of useful tools for network troubleshooting. This tutorial is a basic guide to the netstat command with usage examples to help the new Linux beginner.</p> <h2>Linux netstat command examples</h2> <p>The syntax for netstat command is:</p> <p><b>netstat &lt;option&gt; </b></p> <p>Below are the common options used with netstat command:</p> <table><tr><td><code> –a Lists all listening and non-listening sockets.<br /> –i Displays statistics for your network interfaces.<br /> –l Lists listening sockets.<br /> –s Displays summary information for each protocol.<br /> –r Displays your routing table.<br /></code></td> </tr></table><p>Lists all listening and non-listening sockets using netstat command with <b>-a</b> option:</p> <table><tr><td><code>root@slackware:~# <span style="color:red;">netstat -a</span><br /> Active Internet connections (servers and established)<br /> Proto Recv-Q Send-Q Local Address Foreign Address State<br /> tcp 0 0 *:time *:* LISTEN<br /> tcp 0 0 *:netbios-ssn *:* LISTEN<br /> tcp 0 0 *:auth *:* LISTEN<br /> tcp 0 0 slackware.example.c:domain *:* LISTEN<br /> tcp 0 0 localhost:domain *:* LISTEN<br /> tcp 0 0 *:ssh *:* LISTEN<br /> tcp 0 0 localhost:rndc *:* LISTEN<br /> tcp 0 0 *:microsoft-ds *:* LISTEN<br /> tcp 0 52 slackware.example.com:ssh 192.168.1.6:1320 ESTABLISHED<br /> tcp6 0 0 [::]:ssh [::]:* LISTEN<br /> tcp6 0 0 ::1%8191:rndc [::]:* LISTEN<br /> ...<br /> ...<br /> ...<br /></code></td> </tr></table><p>Displays statistics for Linux network interfaces using netstat command with <b>-i</b> option:</p> <table><tr><td><code>root@slackware:~# <span style="color:red;">netstat -i</span><br /> Kernel Interface table<br /> Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg<br /> eth0 1500 0 156 0 0 0 128 0 0 0 BMRU<br /> lo 16436 0 17 0 0 0 17 0 0 0 LRU<br /> root@slackware:~#<br /></code></td> </tr></table><p>Lists listening sockets using netstat command with <b>-l</b> option: </p> <table><tr><td><code>root@slackware:~# <span style="color:red;">netstat -l</span><br /> Active Internet connections (only servers)<br /> Proto Recv-Q Send-Q Local Address Foreign Address State<br /> tcp 0 0 *:time *:* LISTEN<br /> tcp 0 0 *:netbios-ssn *:* LISTEN<br /> tcp 0 0 *:auth *:* LISTEN<br /> tcp 0 0 slackware.example.c:domain *:* LISTEN<br /> tcp 0 0 localhost:domain *:* LISTEN<br /> tcp 0 0 *:ssh *:* LISTEN<br /> tcp 0 0 localhost:rndc *:* LISTEN<br /> tcp 0 0 *:microsoft-ds *:* LISTEN<br /> tcp6 0 0 [::]:ssh [::]:* LISTEN<br /> tcp6 0 0 ::1%8191:rndc [::]:* LISTEN<br /> udp 0 0 *:biff *:*<br /> udp 0 0 slackware.examp:netbios-ns *:*<br /> udp 0 0 *:netbios-ns *:*<br /> udp 0 0 slackware.exam:netbios-dgm *:*<br /> udp 0 0 *:netbios-dgm *:*<br /> udp 0 0 *:time *:*<br /> udp 0 0 *:48176 *:*<br /> udp 0 0 slackware.example.c:domain *:*<br /> udp 0 0 localhost:domain *:*<br /> udp6 0 0 [::]:50273 [::]:*<br /> Active UNIX domain sockets (only servers)<br /> Proto RefCnt Flags Type State I-Node Path<br /> unix 2 [ ACC ] STREAM LISTENING 7941 /dev/gpmctl<br /> unix 2 [ ACC ] STREAM LISTENING 7064 @/var/run/hald/dbus-hPhDf9IKkl<br /> unix 2 [ ACC ] STREAM LISTENING 7067 @/var/run/hald/dbus-QrEWsdl4tf<br /> unix 2 [ ACC ] STREAM LISTENING 7037 /var/run/dbus/system_bus_socket<br /> unix 2 [ ACC ] STREAM LISTENING 7003 /var/run/acpid.socket<br /> root@slackware:~#<br /></code></td> </tr></table><p>Displays summary information for each protocol using netstat command with <b>-s</b> option:</p> <table><tr><td><code>root@slackware:~# <span style="color:red;">netstat -s</span><br /> Ip:<br /> 263 total packets received<br /> 0 forwarded<br /> 0 incoming packets discarded<br /> 243 incoming packets delivered<br /> 210 requests sent out<br /> Icmp:<br /> 5 ICMP messages received<br /> 0 input ICMP message failed.<br /> ICMP input histogram:<br /> destination unreachable: 3<br /> echo replies: 2<br /> 2 ICMP messages sent<br /> 0 ICMP messages failed<br /> ICMP output histogram:<br /> echo request: 2<br /> IcmpMsg:<br /> InType0: 2<br /> InType3: 3<br /> OutType8: 2<br /> Tcp:<br /> 2 active connections openings<br /> 1 passive connection openings<br /> 2 failed connection attempts<br /> 0 connection resets received<br /> 1 connections established<br /> 175 segments received<br /> 152 segments send out<br /> 0 segments retransmited<br /> 0 bad segments received.<br /> 2 resets sent<br /> Udp:<br /> 63 packets received<br /> 0 packets to unknown port received.<br /> 0 packet receive errors<br /> 56 packets sent<br /> UdpLite:<br /> TcpExt:<br /> 1 delayed acks further delayed because of locked socket<br /> 1 packets directly queued to recvmsg prequeue.<br /> 1 bytes directly received in process context from prequeue<br /> 24 packet headers predicted<br /> 95 acknowledgments not containing data payload received<br /> 2 predicted acknowledgments<br /> IpExt:<br /> InBcastPkts: 37<br /> OutBcastPkts: 25<br /> root@slackware:~#<br /></code></td> </tr></table><p>Displays Linux routing table using netstat command with <b>-r</b> option:</p> <table><tr><td><code>root@slackware:~# <span style="color:red;">netstat -r</span><br /> Kernel IP routing table<br /> Destination Gateway Genmask Flags MSS Window irtt Iface<br /> localnet * 255.255.255.0 U 0 0 0 eth0<br /> loopback * 255.0.0.0 U 0 0 0 lo<br /> default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0<br /> root@slackware:~#<br /></code></td> </tr></table><p>Back to <a href="/linuxnetwork">Linux network commands</a> tutorial page.</p> </div></div></div><!-- google_ad_section_end --><div class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above"><div class="field-label">Tags:&nbsp;</div><div class="field-items"><div class="field-item even" rel="dc:subject"><a href="/taxonomy/term/3" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">linux commands</a></div><div class="field-item odd" rel="dc:subject"><a href="/taxonomy/term/14" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">basic network</a></div></div></div> Thu, 04 Sep 2008 08:28:24 +0000 jinlusuh 111 at http://basicconfig.com http://basicconfig.com/linuxnetwork/netstat#comments Linux networking - Installing Ethernet card http://basicconfig.com/linuxnetwork/ethernet <!-- google_ad_section_start --><div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p>Ethernet card or more commonly known as network interface card is a required component if you want to connect to the network. Ethernet card is available in two version which are the PCI slot or the older ISA card. </p> <p>However, nowadays computer always comes with integrated Ethernet with motherboard. That's good, our Ethernet card can be the second network card. This is required if we want to configure our Linux to be a gateway router or a firewall later.</p> <h4>Installing an Ethernet card</h4> <ol><li>Power off your computer.</li> <li>Open computer casing and Install your PCI Ethernet card in an available PCI expansion slot (an ISA card into ISA slot).</li> <li>Close computer casing and plug in network cable into the Ethernet port and the other end into the router port (cat5 cable with rj45 socket)</li> <li>Power on your computer.</li> <li>Normally Linux will detect the Ethernet card and load appropriate kernel when you boot up the system. However if Linux doesn't detect it, you must manually configure the Etehrnet card by loading appropriate module using modprobe.</li> <li>After Linux has finished boot up, check /etc/modprobe.conf (Slackware /etc/modprobe.d/modprobe.conf) that appropriate kernel has been loaded.</li> <li>Type less /etc/modprobe.conf and verify that the alias eth0 has been created (and eth1 if you installed second Ethernet card). If not then you may need to manually edit this file and create the appropriate alias. If you don’t, you’ll lose your networking configuration when the system reboots.</li> </ol><p>When you 're done, then it time to configure the ip address for the Ethernet card.</p> </div></div></div><!-- google_ad_section_end --><div class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above"><div class="field-label">Tags:&nbsp;</div><div class="field-items"><div class="field-item even" rel="dc:subject"><a href="/taxonomy/term/14" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">basic network</a></div></div></div> Wed, 03 Sep 2008 15:23:45 +0000 jinlusuh 108 at http://basicconfig.com http://basicconfig.com/linuxnetwork/ethernet#comments Linux networking - ip address and subnet mask http://basicconfig.com/linuxnetwork/networking <!-- google_ad_section_start --><div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p>Networking is essential when talking Linux into subject. As you already know, Linux derived from Unix which serve network as servers. So Linux user must have a basic knowledge about networking, especially the IP protocols and ethernet.</p> <p>IP protocol is one of the protocols that make a networking possible. What is a protocol? In a computer networking jargon, a protocol is a rules that govern communication between two systems. Like a language in human world which allows human to communicate with each other. So, ip protocol is a standard communication rules in computer networking. In order to understand each other, all operating system, Linux, windows, Unix, Mac OS must follow one rules or protocol. That's the brief desciption of ip protocol. Now you know that Internet uses the ip protocol :-)</p> <p>When talking about ip protocol, you should know the next subject which is ip address. Ip address is a unique address assigned to one network computer. This is important because a network computer must know which computer it is communicating with such as in client talking to a server situation. Ip address is divided into three classes which are class A, class B and class C. </p> <p>Next is subnet mask. Every time we assign an ip address to a network computer, we must also assign a subnet mask. Ip address comes with different subnet mask depending on it's class. In each ip classes, the subnet mask defines network segment of that system. It says how much of the address is used for the network is defined by the subnet mask. </p> <p>Ip address classes and subnet mask:</p> <ul><li>Class A The decimal value of the first octet must be between 1 and 126.<br /> In a Class A address, the first octet is the network address and the last three<br /> octets are the node address. Therefore, the default subnet mask is 255.0.0.0. </li> <li>Class B The decimal value of the first octet must be between 128 and 191.<br /> In a Class B address, the first two octets are the network address and the<br /> last two octets are the node address. Therefore, the default subnet mask is<br /> 255.255.0.0. </li> <li>Class C The decimal value of the first octet must be between 192 and<br /> 223. In a Class C address, the first three octets are the network address while<br /> the last octet is the node address. Therefore, the default subnet mask is<br /> 255.255.255.0. </li> </ul></div></div></div><!-- google_ad_section_end --><div class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above"><div class="field-label">Tags:&nbsp;</div><div class="field-items"><div class="field-item even" rel="dc:subject"><a href="/taxonomy/term/14" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">basic network</a></div></div></div> Tue, 02 Sep 2008 18:02:46 +0000 jinlusuh 107 at http://basicconfig.com http://basicconfig.com/linuxnetwork/networking#comments Linux route command description and examples http://basicconfig.com/linuxnetwork/route <!-- google_ad_section_start --><div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p>Besides Linux ifconfig command, the Linux route command is another important network commands every Linux user should know. The route command can be used to add or modify a static route and a default gateway in the Linux or Unix system. As specify in the Linux Programmer's Manual, Linux route command shows or manipulate the IP routing table. The IP stated is the Internet Protocol (ip address, netmask, gateway) which has been set during configuring network interface card (NIC) in the Linux ifconfig tutorial earlier.</p> <p>The Linux route command comes with many options but most network administrators familiar with <b>add</b> and <b>del</b> options. The <em>route add</em> command is used to add a new route while the <em>route del</em> command is to delete a route.</p> <p>The route add syntax:<br /><b>route add -net &lt; ip address &gt; netmask &lt; netmask ip &gt; dev &lt; interface &gt;</b></p> <p>Where:<br /> &lt; ip address &gt; is network interface card ip address<br /> &lt; netmask ip &gt; ip netmask such 255.255.255.0<br /> Interface = eth0, eth1, eth2, etc</p> <p>The route del syntax:<br /><b>route del -net &lt; ip address &gt; netmask &lt; netmask ip &gt; dev &lt;interface &gt;</b></p> <p>Where:<br /> &lt;ip address &gt; is network interface card ip address<br /> &lt;netmask ip &gt; ip netmask such 255.255.255.0<br /> Interface = eth0, eth1, eth2, etc</p> <p>Here is an example of Linux route command in action: <a href="/basicnetwork#route">Linux basic network configurations.</a> </p> <p>Below is a complete manual when issuing the <b>man route</b> command in the command line terminal. Do remember that in order to use route command you must have root privilege. </p> <table><tr><td><code>ROUTE(8) Linux Programmer's Manual ROUTE(8)<br /><br /> NAME<br /> route - show / manipulate the IP routing table<br /><br /> SYNOPSIS<br /> route [-CFvnee]<br /><br /> route [-v] [-A family] add [-net|-host] target [netmask Nm] [gw Gw]<br /> [metric N] [mss M] [window W] [irtt I] [reject] [mod] [dyn]<br /> [reinstate] [[dev] If]<br /><br /> route [-v] [-A family] del [-net|-host] target [gw Gw] [netmask Nm]<br /> [metric N] [[dev] If]<br /><br /> route [-V] [--version] [-h] [--help]<br /><br /> DESCRIPTION<br /> Route manipulates the kernel's IP routing tables. Its primary use is<br /> to set up static routes to specific hosts or networks via an interface<br /> after it has been configured with the ifconfig(8) program.<br /><br /> When the add or del options are used, route modifies the routing<br /> tables. Without these options, route displays the current contents of<br /> the routing tables.<br /><br /> OPTIONS<br /> -A family<br /> use the specified address family (eg `inet'; use `route --help'<br /> for a full list).<br /><br /> -F<br /> operate on the kernel's FIB (Forwarding Information Base)<br /> routing table. This is the default. <p> -C operate on the kernel's routing cache.<br /><br /> -v select verbose operation.<br /><br /> -n<br /> show numerical addresses instead of trying to determine<br /> symbolic host names. This is useful if you are trying to<br /> determine why the route to your nameserver has vanished.<br /><br /> -e use netstat(8)-format for displaying the routing table. -ee<br /> will generate a very long line with all parameters from the<br /> routing table.<br /><br /> del delete a route.<br /><br /> add add a new route.<br /><br /> target<br /> the destination network or host. You can provide IP addresses<br /> in dotted decimal or host/network names.<br /><br /> -net the target is a network.<br /><br /> -host the target is a host.<br /><br /> netmask NM<br /> when adding a network route, the netmask to be used.<br /><br /> gw GW route packets via a gateway. NOTE: The specified gateway must<br /> be reachable first. This usually means that you have to set up a<br /> static route to the gateway beforehand. If you specify the<br /> address of one of your local interfaces, it will be used to<br /> decide about the interface to which the packets should be routed<br /> to. This is a BSDism compatibility hack.<br /><br /> metric M<br /> set the metric field in the routing table (used by routing dae-<br /> mons) to M.<br /><br /> mss M<br /> set the TCP Maximum Segment Size (MSS) for connections over<br /> this route to M bytes. The default is the device MTU minus<br /> headers, or a lower MTU when path mtu discovery occured.<br /> This setting can be used to force smaller TCP packets on the<br /> other end when path mtu discovery does not work (usually<br /> because of misconfigured firewalls that block ICMP<br /> Fragmentation Needed)<br /><br /> window W<br /> set the TCP window size for connections over this route to W<br /> bytes. This is typically only used on AX.25 networks and with<br /> drivers unable to handle back to back frames.<br /><br /> irtt I set the initial round trip time (irtt) for TCP connections over<br /> this route to I milliseconds (1-12000). This is typically only<br /> used on AX.25 networks. If omitted the RFC 1122 default of<br /> 300ms is used.<br /><br /> reject install a blocking route, which will force a route lookup to<br /> fail. This is for example used to mask out networks before<br /> using the default route. This is NOT for firewalling.<br /><br /> mod, dyn, reinstate<br /> install a dynamic or modified route. These flags are for diag-<br /> nostic purposes, and are generally only set by routing<br /> daemons.<br /><br /> dev If force the route to be associated with the specified device, as<br /> the kernel will otherwise try to determine the device on its own<br /> (by checking already existing routes and device specifications,<br /> and where the route is added to). In most normal networks you<br /> won't need this.<br /><br /> If dev If is the last option on the command line, the word dev<br /> may be omitted, as it's the default. Otherwise the order of the<br /> route modifiers (metric - netmask - gw - dev) doesn't matter.<br /><br /> EXAMPLES<br /> route add -net 127.0.0.0<br /> adds the normal loopback entry, using netmask 255.0.0.0 (class<br /> A net, determined from the destination address) and associated<br /> with the "lo" device (assuming this device was prviously set up<br /> correctly with ifconfig(8)).<br /><br /> route add -net 192.56.76.0 netmask 255.255.255.0 dev eth0<br /> adds a route to the network 192.56.76.x via "eth0". The Class C<br /> netmask modifier is not really necessary here because 192.* is a<br /> Class C IP address. The word "dev" can be omitted here.<br /><br /> route add default gw mango-gw<br /> adds a default route (which will be used if no other route<br /> matches). All packets using this route will be gatewayed<br /> through "mango-gw". The device which will actually be used for<br /> that route depends on how we can reach "mango-gw" - the static<br /> route to "mango-gw" will have to be set up before.<br /><br /> route add ipx4 sl0<br /> Adds the route to the "ipx4" host via the SLIP interface (assum-<br /> ing that "ipx4" is the SLIP host).<br /><br /> route add -net 192.57.66.0 netmask 255.255.255.0 gw ipx4<br /> This command adds the net "192.57.66.x" to be gatewayed<br /> through the former route to the SLIP interface.<br /><br /> route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0<br /> This is an obscure one documented so people know how to do<br /> it. This sets all of the class D (multicast) IP routes to go via<br /> "eth0". This is the correct normal configuration line with a<br /> multicasting kernel.<br /><br /> route add -net 10.0.0.0 netmask 255.0.0.0 reject<br /> This installs a rejecting route for the private network<br /> "10.x.x.x."<br /><br /> OUTPUT<br /> The output of the kernel routing table is organized in the following<br /> columns<br /><br /> Destination<br /> The destination network or destination host.<br /><br /> Gateway<br /> The gateway address or '*' if none set.<br /><br /> Genmask<br /> The netmask for the destination net; '255.255.255.255' for a<br /> host destination and '0.0.0.0' for the default route.<br /><br /> Flags Possible flags include<br /> U (route is up)<br /> H (target is a host)<br /> G (use gateway)<br /> R (reinstate route for dynamic routing)<br /> D (dynamically installed by daemon or redirect)<br /> M (modified from routing daemon or redirect)<br /> A (installed by addrconf)<br /> C (cache entry)<br /> ! (reject route)<br /><br /> Metric<br /> The 'distance' to the target (usually counted in hops). It is<br /> not used by recent kernels, but may be needed by routing<br /> daemons.<br /><br /> Ref Number of references to this route. (Not used in the Linux ker-<br /> nel.)<br /><br /> Use Count of lookups for the route. Depending on the use of -F<br /> and -C this will be either route cache misses (-F) or hits (-C).<br /><br /> Iface Interface to which packets for this route will be sent.<br /><br /> MSS Default maximum segement size for TCP connections over<br /> this route.<br /><br /> Window Default window size for TCP connections over this route.<br /><br /> irtt Initial RTT (Round Trip Time). The kernel uses this to guess<br /> about the best TCP protocol parameters without waiting on (pos-<br /> sibly slow) answers.<br /><br /> HH (cached only)<br /> The number of ARP entries and cached routes that refer to the<br /> hardware header cache for the cached route. This will be -1 if a<br /> hardware address is not needed for the interface of the cached<br /> route (e.g. lo).<br /><br /> Arp (cached only)<br /> Whether or not the hardware address for the cached route<br /> is up to date.<br /><br /> FILES<br /> /proc/net/ipv6_route<br /> /proc/net/route<br /> /proc/net/rt_cache<br /><br /> SEE ALSO<br /> ifconfig(8), netstat(8), arp(8), rarp(8)<br /><br /> HISTORY<br /> Route for Linux was originally written by Fred N. van Kempen,<br /><waltje> and then modified by Johannes Stille<br /> and Linus Torvalds for pl15. Alan Cox added the mss and window<br /> options for Linux 1.1.22. irtt support and merged with netstat from<br /> Bern Eckenfels.<br /><br /> AUTHOR<br /> Currently maintained by Phil Blundell <philip>.<br /><br /> net-tools 2 January 2000 ROUTE(8)<br /></philip></waltje></p></code></td> </tr></table><p>Back to <a href="/linuxnetwork">Linux network command</a> tutorial page.</p> </div></div></div><!-- google_ad_section_end --><div class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above"><div class="field-label">Tags:&nbsp;</div><div class="field-items"><div class="field-item even" rel="dc:subject"><a href="/taxonomy/term/14" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">basic network</a></div><div class="field-item odd" rel="dc:subject"><a href="/taxonomy/term/3" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">linux commands</a></div></div></div> Sat, 30 Aug 2008 18:03:56 +0000 jinlusuh 112 at http://basicconfig.com http://basicconfig.com/linuxnetwork/route#comments Configure Linux ip address with ifconfig command http://basicconfig.com/linuxnetwork/ifconfig <!-- google_ad_section_start --><div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p>Linux ifconfig command is used to setup a network interface card (NIC). It means we can use ifconfig command to configure ip address, netmask and gateway for the card. The ifconfig command is also used to configure or tuning the network interface card such as changing the ip address or assigning ip alias, protocol, parameter and other options. We can also use ifconfig command to view network interface card's status and to activate or deactivate the interface driver.</p> <p>User need to have root privileged in order to use the ifconfig command. So, switch to root by issuing su command. For a Ubuntu Linux add a sudo before the ifconfig command.</p> <p>ifconfig's syntax to configure ip address, netmask and to activate or deactivate network interface card:<br /><b>ifconfig &lt;interface&gt; &lt;ip address&gt; netmask &lt;netmask ip&gt; up/down</b></p> <p>Where:<br /> &lt;interface&gt; = Network interface card (eth0, eth1, etc)<br /> &lt;ip address&gt; = NIC ip address (i.e. 192.168.1.5)<br /> &lt;netmask ip&gt; = netmask ip (i.e. 255.255.255.0)<br /> up/down = Choose up to activate and down to deactivate.</p> <p>Example:<br /><b>ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up</b></p> <h3>Simple way to configure Linux ip address</h3> <p>ifconfig's syntax:<br /><b>ifconfig [interface] [ip address] [option]</b></p> <p>Use ifconfig command to change ip address of the first network interface card example:<br /><b>ifconfig eth0 192.168.1.5</b></p> <p>Use ifconfig command to change ip address of the second network interface card example:<br /><b>ifconfig eth1 10.21.35.5</b></p> <p>Use ifconfig command to change netmask of the first network interface card example:<br /><b>ifconfig eth0 netmask 255.255.255.0</b></p> <p>Use ifconfig command to change netmask of the second network interface card example:<br /><b>ifconfig eth0 netmask 255.255.255.0</b></p> <p>Example on how to bring up the first network interface card using Linux ifconfig command:<br /><b>ifconfig eth0 192.168.1.5 up</b></p> <p>Example on how to bring down the first network interface card using Linux ifconfig command:<br /><b>ifconfig eth0 down</b></p> <p>If users want to see ifconfig in action, visit <a href="/basicnetwork#ifconfig">Linux basic network configuration.</a></p> <p>Please check Linux ifconfig manual page using 'man ifconfig' command to see more details.</p> </div></div></div><!-- google_ad_section_end --><div class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above"><div class="field-label">Tags:&nbsp;</div><div class="field-items"><div class="field-item even" rel="dc:subject"><a href="/taxonomy/term/3" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">linux commands</a></div><div class="field-item odd" rel="dc:subject"><a href="/taxonomy/term/14" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">basic network</a></div></div></div> Sat, 30 Aug 2008 16:50:16 +0000 jinlusuh 110 at http://basicconfig.com http://basicconfig.com/linuxnetwork/ifconfig#comments Linux telnet command guides http://basicconfig.com/linuxnetwork/telnet <!-- google_ad_section_start --><div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p>Telnet is the most known remote login server. Perhaps all computer background people familiar with telnet, at least to check server networking status (that's what network officers at my place do anyway!). However, in this tutorial we are going to do more than that.</p> <h2>Configure telnet server</h2> <p>Now let's take a closer look at the Linux telnet program itself. Normally telnet comes with all major Linux distributions. In Slackware Linux, the telnet daemon can be enabled in the super server, inetd (xinetd in Redhat and Fedora). At the command, type vim /etc/inetd.conf to activate telnet server. It's the same for other Linux distributions except for system V based distributions such as Redhat Linux and Fedora Linux.</p> <table><tr><td><code> root@slackware:~$ <span style="color:#FF0000;"> vim /etc/inetd.conf </span><br /></code></td> </tr></table><p>Looking for <b># Telnet server</b> like in the figure below:</p> <table><tr><td><code> # Telnet server:<br /> # telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd<br /> #<br /></code></td> </tr></table><p>Now remove <b>#</b> at the beginning line of the script by pressing <em>x</em> key on the keyboard to activate telnet server. Exit and save the inetd.conf file with command ':wq'. Restart the super server with command below:</p> <table><tr><td><code> root@slackware:~$ /etc/rc.d/rc.inetd restart<br /></code></td> </tr></table><h2>Using Linux telnet program</h2> <p>We have finish setting up the Linux telnet server in Slackware Linux. Let's testing the telnet server now. Please take note that in order to use the telnet program, we must have a network connection and a client computer, it doesn't matter whether Linux or windows installed. Remember that we use telnet to remotely manage a server.</p> <p>To run a telnet program on windows computer, open command prompt by clicking on Start --&gt; Run and type 'cmd'. Type <em>telnet</em> at the command prompt and press Enter. You should have something like the example figure below. This is a Microsoft Telnet Client.</p> <table><tr><td><code> Welcome to Microsoft Telnet Client<br /> Escape Character is 'CTRL+]'<br /> Microsoft Telnet&gt;<br /></code></td> </tr></table><p>Let's see what command can we use in telnet program. Type 'help' and Enter.</p> <table><tr><td><code> ftp&gt; <span style="color:#FF0000;"> help </span><br /> Commands may be abbreviated. Commands are:<br /> c - close close current connection<br /> d - display display operating parameters<br /> o - open hostname [port] connect to hostname (default port 23).<br /> q - quit exit telnet<br /> set - set set options (type 'set ?' for a list)<br /> sen - send send strings to server<br /> st - status print status information<br /> u - unset unset options (type 'unset ?' for a list)<br /> ?/h - help print help information<br /> Microsoft Telnet&gt;<br /></code></td> </tr></table><p>So we can see that the command '<strong>o</strong>' is used to open a connection to hostname. Type <strong>'o' &lt;hostname ip address&gt;</strong> and press Enter:</p> <table><tr><td><code> Welcome to Microsoft Telnet Client<br /> Escape Character is 'CTRL+]'<br /> Microsoft Telnet&gt; o 192.168.0.5<br /></code></td> </tr></table><p>If there is no problem with the network and port 23 for telnet is open, you'll get login prompt for the remote machine. Now that you already connected to the remote machine, login as usual, provide your account name and password. See telnet login example below:</p> <table><tr><td><code> Welcome to Linux 2.4.29 (tty1) <p> login: labu<br /> Password:<br /> [labu@slackware labu]$<br /></p></code></td> </tr></table><p>Back to <a href="/linuxnetwork">Linux network command</a> tutorial page.</p> </div></div></div><!-- google_ad_section_end --><div class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above"><div class="field-label">Tags:&nbsp;</div><div class="field-items"><div class="field-item even" rel="dc:subject"><a href="/taxonomy/term/3" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">linux commands</a></div><div class="field-item odd" rel="dc:subject"><a href="/taxonomy/term/14" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">basic network</a></div></div></div> Fri, 01 Feb 2008 13:19:59 +0000 jinlusuh 113 at http://basicconfig.com http://basicconfig.com/linuxnetwork/telnet#comments Linux basic network - Configure ip address http://basicconfig.com/basicnetwork <!-- google_ad_section_start --><div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p>If you want to access Internet or your local network, you must have a network card (NIC). The drivers needed can be found in <strong>slackware/n3/netmods.tgz</strong> in your Slackware CD. If you installed all packages, then you must have the netmods package in your system already.</p> <h2>Linux network configuration</h2> <p>There are many network utilities in Linux that can be used to configure Ethernet ip address, netmask, routing table, name server and so on. Below are essential Linux commands used to configure Linux ip address.</p> <h3><a name="ifconfig" id="ifconfig"></a>Linux ifconfig command</h3> <p>The Linux ifconfig command can be used to configure a network interface card or Ethernet card. If the Linux ifconfig command issued without any argument or option, it displays the status of the currently active interfaces. See part of ifconfig manual page below:</p> <table><tr><td><code>NAME<br /> ifconfig - configure a network interface<br /><br /> SYNOPSIS<br /> ifconfig [-v] [-a] [-s] [interface]<br /> ifconfig [-v] interface [aftype] options | address ...<br /><br /> DESCRIPTION<br /> Ifconfig is used to configure the kernel-resident network interfaces.<br /> It is used at boot time to set up interfaces as necessary. After that,<br /> it is usually only needed when debugging or when system tuning is<br /> needed.<br /><br /> If no arguments are given, ifconfig displays the status of the currently<br /> active interfaces. If a single interface argument is given, it<br /> displays the status of the given interface only; if a single -a argument<br /> is given, it displays the status of all interfaces, even those<br /> that are down. Otherwise, it configures an interface.<br /></code></td> </tr></table><p>Here is a complete usage syntax: </p> <table><tr><td><code>Usage:<br /> ifconfig [-a] [-v] [-s] &lt;interface&gt; [[&lt;AF&gt;] &lt;address&gt;]<br /> [add &lt;address&gt;[/&lt;prefixlen&gt;]]<br /> [del &lt;address&gt;[/&lt;prefixlen&gt;]]<br /> [[-]broadcast [&lt;address&gt;]] [[-]pointopoint [&lt;address&gt;]]<br /> [netmask &lt;address&gt;] [dstaddr &lt;address&gt;] [tunnel &lt;address&gt;]<br /> [outfill &lt;NN&gt;] [keepalive &lt;NN&gt;]<br /> [hw &lt;HW&gt; &lt;address&gt;] [metric &lt;NN&gt;] [mtu &lt;NN&gt;]<br /> [[-]trailers] [[-]arp] [[-]allmulti]<br /> [multicast] [[-]promisc]<br /> [mem_start &lt;NN&gt;] [io_addr &lt;NN&gt;] [irq &lt;NN&gt;] [media &lt;type&gt;]<br /> [txqueuelen &lt;NN&gt;]<br /> [[-]dynamic]<br /> [up|down] ...<br /><br /> &lt;HW&gt;=Hardware Type.<br /> List of possible hardware types:<br /> loop (Local Loopback) slip (Serial Line IP) cslip (VJ Serial Line IP)<br /> slip6 (6-bit Serial Line IP) cslip6 (VJ 6-bit Serial Line IP) adaptive (Adaptive Serial Line IP)<br /> strip (Metricom Starmode IP) ash (Ash) ether (Ethernet)<br /> tr (16/4 Mbps Token Ring) tr (16/4 Mbps Token Ring (New)) ax25 (AMPR AX.25)<br /> netrom (AMPR NET/ROM) rose (AMPR ROSE) tunnel (IPIP Tunnel)<br /> ppp (Point-to-Point Protocol) hdlc ((Cisco)-HDLC) lapb (LAPB)<br /> arcnet (ARCnet) dlci (Frame Relay DLCI) frad (Frame Relay Access Device)<br /> sit (IPv6-in-IPv4) fddi (Fiber Distributed Data Interface) hippi (HIPPI)<br /> irda (IrLAP) ec (Econet) x25 (generic X.25)<br /> eui64 (Generic EUI-64)<br /> &lt;AF&gt;=Address family. Default: inet<br /> List of possible address families:<br /> unix (UNIX Domain) inet (DARPA Internet) inet6 (IPv6)<br /> ax25 (AMPR AX.25) netrom (AMPR NET/ROM) rose (AMPR ROSE)<br /> ipx (Novell IPX) ddp (Appletalk DDP) ec (Econet)<br /> ash (Ash) x25 (CCITT X.25)<br /></code></td> </tr></table><p>See ifconfig command invoke with no option example below:</p> <table><tr><td><code>root@slackware:~# <span style="color:red">ifconfig </span><br /> eth0 Link encap:Ethernet HWaddr 00:aa:11:bb:22:cc<br /><span style="color:red;">inet addr:10.10.0.6 Bcast:10.21.35.255 Mask:255.255.0.0 </span><br /> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1<br /> RX packets:0 errors:0 dropped:0 overruns:0 frame:0<br /> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0<br /> collisions:0 txqueuelen:1000<br /> RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)<br /> Interrupt:11 Base address:0x1080<br /><br /> lo Link encap:Local Loopback<br /> inet addr:127.0.0.1 Mask:255.0.0.0<br /> UP LOOPBACK RUNNING MTU:16436 Metric:1<br /> RX packets:0 errors:0 dropped:0 overruns:0 frame:0<br /> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0<br /> collisions:0 txqueuelen:0<br /> RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)<br /></code></td> </tr></table><p>The first paragraph above shows the first Ethernet card, eth0 configuration. The line in red shows Ethernet ip address, broadcast and netmask. The second paragraph shows localhost or loopback configuration. </p> <p>This is an example on how to use ifconfig command to setup a new Linux ip address for the first Ethernet card:</p> <table><tr><td><code>root@slackware:~#<span style="color:red;"> ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up </span><br /></code></td> </tr></table><h3><a name="route" id="route"></a>Linux route command</h3> <p>After setting up a Linux ip address with ifconfig command, use Linux route command to set up static routes to specific hosts or networks. Linux route command is a tool where you can setup where to send which data. Basically you can use route command to show and manipulate routing table. This is an example of how to use route command in Linux. Issue <strong>route</strong> command without any option will print current routing table.</p> <p>To add a new ip route via eth0 (first Ethernet card), issue <strong>route add</strong> command in this format:</p> <p><strong>route add -net &lt;ip&gt; netmask &lt;ip&gt; dev eth0</strong></p> <table><tr><td><code>root@slackware:~# <span style="color:red;">route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0 </span><br /></code></td> </tr></table><p>You can also add a gateway of the network:</p> <p><strong>route add -net &lt;ip&gt; gw &lt;ip&gt; netmask &lt;ip&gt; dev eth0</strong></p> <table><tr><td><code>root@slackware:~# <span style="color:red;">route add -net 192.168.1.0 gw 192.168.1.1 netmask 255.255.255.0 dev eth0 </span><br /></code></td> </tr></table><p>Now, check the routing table again:</p> <table><tr><td><code>root@slackware:~# <span style="color:red;">route</span><br /> Kernel IP routing table<br /> Destination Gateway Genmask Flags Metric Ref Use Iface<br /> 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0<br /> loopback * 255.0.0.0 U 0 0 0 lo<br /> default 192.168.1.1 0.0.0.0 UG 1 0 0 eth0<br /> root@slackware:~#<br /></code></td> </tr></table><p>We can see all configurations we made is in the result above.</p> <h3>Slackware netconfig</h3> <p> In Slackware, a setup program called ‘<strong>netconfig</strong>’ is very easy to use and very helpful for a beginner to setup Linux ip address including basic network configuration. Let’s try it. You must login as root because as a normal user, you don’t have power to configure network. From root command prompt, type ‘<strong>netconfig</strong>’ and Enter. You'll have a screen like this:</p> <p><a href="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/basic_network01.png" title="Image" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/thumbs/basic_network01.png" alt="netconfig program - enter hostname screenshot" /></a></p> <p>Enter your hostname for example ‘linuxserver’. Move to &lt;ok&gt; by using the Tab key, Enter to continue.</p> <p><a href="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/basic_network02.png" title="Image" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/thumbs/basic_network02.png" alt="netconfig program - enter domain name screenshot" /></a></p> <p>Now you must provide a domain name for your host. Enter your domain name. When you finished, press Enter to continue.</p> <p><a href="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/basic_network03.png" title="Image" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/thumbs/basic_network03.png" alt="netconfig program - choose network type screenshot" /></a></p> <p>We’ll learn how to set up static IP address now. Use arrow key to move up and down. Choose ‘Static IP’ and Enter. On the next screen, you have to provide an IP address. Enter your IP address and Enter to continue.</p> <p><a href="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/basic_network04.png" title="Image" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/thumbs/basic_network04.png" alt="netconfig program - enter ip address screenshot" /></a></p> <p>Now Enter the netmask. </p> <p><a href="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/basic_network05.png" title="Image" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/thumbs/basic_network05.png" alt="netconfig program - enter netmask screenshot" /></a></p> <p>Enter your gateway IP address. If you don’t have any gateway yet, or you are planning to use this server as a gateway, then use the same IP address.</p> <p><a href="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/basic_network06.png" title="Image" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/thumbs/basic_network06.png" alt="netconfig program - enter gateway address screenshot" /></a></p> <p>You’ll be asked whether you will be accessing a name server. The name server here means your DNS server address or your ISP DNS ip address.</p> <p><a href="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/basic_network07.png" title="Image" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/thumbs/basic_network07.png" alt="netconfig program - name server" /></a></p> <p>Enter your name server ip address. If you are using name server, you can enter it here</p> <p><a href="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/basic_network08.png" title="Image" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/thumbs/basic_network08.png" alt="netconfig program - enter name server ip address screenshot" /></a></p> <p>In this screen, you have to confirm your network setup. Move up and down using arrow key. If you want to edit something, you can do it now, and Tab to edit and Enter.</p> <p><a href="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/basic_network09.png" title="Image" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/thumbs/basic_network09.png" alt="netconfig program - netconfig summary screenshot" /></a></p> <p>When you are done, Tab to ‘Accept’ and Enter. If you accept the setting, Enter one more time to confirm. That’s it, you are done. You will have the root command prompt again. </p> <p><a href="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/basic_network10.png" title="Image" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/thumbs/basic_network10.png" alt="netconfig program - netconfig complete screenshot" /></a></p> <p>Type ‘clear’ at the root command prompt to clear the screen.</p> <p>Normally, the <strong>ifconfig</strong> command is used to configure network interface card. Slackware make our job easier with netconfig. However, ifconfig is still an important Linux command. The ifconfig command can be used to check our Linux network configuration.</p> <p>Let's confirm what we’ve done above with ifconfig command. Type 'ifconfig' and enter as example below:</p> <table><tr><td><code>root@slackware:~# <span style="color:red;">ifconfig</span><br /> lo Link encap:Local Loopback<br /> inet addr:127.0.0.1 Mask:255.0.0.0<br /> UP LOOPBACK RUNNING MTU:16436 Metric:1<br /> RX packets:0 errors:0 dropped:0 overruns:0 frame:0<br /> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0<br /> collisions:0 txqueuelen:0<br /> RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)<br /><br /> root@slackware:~#<br /></code></td> </tr></table><p> Check the <strong>inet addr</strong> and <strong>Mask</strong>. What? We still have the old data? Don't worry, keep on reading.</p> <h3>Stop and start linux service</h3> <p>So now we must update the Linux network configuration data that we setup with netconfig just now. What we have to do is restart the service which means stop and start the service again. Remember about /etc/rc.d directory? The service we want to restart is <b>rc.inet1</b>. This is the complete command to stop and start a service:</p> <table><tr><td><code>root@slackware:~# <span style="color:red;">/etc/rc.d/rc.inet1 stop</span><br /> root@slackware:~# <span style="color:red;">/etc/rc.d/rc.inet1 start</span><br /> root@slackware:~# ifconfig<br /> eth0 Link encap:Ethernet HWaddr 00:aa:11:bb:22:cc<br /> inet addr:192.168.1.5 Bcast:192.168.1.255 Mask:255.255.255.0<br /> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1<br /> RX packets:0 errors:0 dropped:0 overruns:0 frame:0<br /> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0<br /> collisions:0 txqueuelen:1000<br /> RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)<br /> Interrupt:11 Base address:0x1080<br /><br /> lo Link encap:Local Loopback<br /> inet addr:127.0.0.1 Mask:255.0.0.0<br /> UP LOOPBACK RUNNING MTU:16436 Metric:1<br /> RX packets:0 errors:0 dropped:0 overruns:0 frame:0<br /> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0<br /> collisions:0 txqueuelen:0<br /> RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)<br /><br /> root@slackware:~#<br /></code></td> </tr></table><p>You can also use '/etc/rc.d/rc.inet1 restart' command to do the above task.</p> <h3>Setup and configure a second network card</h3> <p>If we have another network card in the computer, then we can configure it now. However we can't use netconfig anymore. The netconfig tool is used to configure Linux ip address for the first network card. For the second network card, we can setup ip address by manually edit the /etc/rc.d/rc.inet1.conf file. Open the file with text editor, such as vim and in the eth1 section (a second network card), add your network configuration data. Also, you should add <b>HWADDR</b> data, which is the mac address of the network card because we don't want the eth0 and eth1 swap every time we reboot Linux. The 'HWADDR' data is unique. To see check what your mac address is, use ifconfig command as in the ifconfig example above. Write the address and then open /etc/rc.d/rc.inet1.conf file with text editor. See example below:</p> <table><tr><td><code># /etc/rc.d/rc.inet1.conf<br /> #<br /> # This file contains the configuration settings for network interfaces.<br /> # If USE_DHCP[interface] is set to "yes", this overrides any other settings.<br /> # If you don't have an interface, leave the settings null ("").<br /><br /> # You can configure network interfaces other than eth0,eth1... by setting<br /> # IFNAME[interface] to the interface's name. If IFNAME[interface] is unset<br /> # or empty, it is assumed you're configuring eth<interface>.<br /><br /> # Several other parameters are available, the end of this file contains a<br /> # comprehensive set of examples.<br /><br /> # =============================================================================<br /><br /> # Config information for eth0:<br /> IPADDR[0]="192.168.1.5"<br /> NETMASK[0]="255.255.255.0"<br /> HWADDR[0]=<span style="color:red;">"00:aa:11:bb:22:cc"</span><br /> USE_DHCP[0]=""<br /> DHCP_HOSTNAME[0]=""<br /><br /> # Config information for eth1:<br /> IPADDR[1]=<span style="color:red;">"192.168.2.1"</span><br /> NETMASK[1]=<span style="color:red;">"255.255.255.0"</span><br /> HWADDR[1]=<span style="color:red;">"33:aa:44:bb:55:cc"</span><br /> USE_DHCP[1]=""<br /> DHCP_HOSTNAME[1]=""<br /></interface></code></td> </tr></table><p>That's it, save the file and restart rc.inet1 daemon. Run the 'ifconfig' command to update the new network card data.</p> <table><tr><td><code>root@slackware:~# ifconfig<br /> eth0 Link encap:Ethernet HWaddr 00:aa:11:bb:22:cc<br /> inet addr:192.168.1.5 Bcast:192.168.1.255 Mask:255.255.255.0<br /> inet6 addr: fe80::223:cdff:feb4:9f1f/64 Scope:Link<br /> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1<br /> RX packets:1895974 errors:0 dropped:28 overruns:0 frame:0<br /> TX packets:411289 errors:0 dropped:0 overruns:0 carrier:0<br /> collisions:0 txqueuelen:1000<br /> RX bytes:674815483 (643.5 MiB) TX bytes:73677358 (70.2 MiB)<br /> Interrupt:17 Base address:0xe800<br /><br /> eth1 Link encap:Ethernet HWaddr 33:aa:44:bb:55:cc<br /> inet addr:192.168.2.1 Bcast:192.168.2.255 Mask:255.255.255.0<br /> inet6 addr: fe80::21b:fcff:fed3:e47f/64 Scope:Link<br /> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1<br /> RX packets:332574 errors:0 dropped:35 overruns:0 frame:0<br /> TX packets:470231 errors:0 dropped:0 overruns:0 carrier:8<br /> collisions:0 txqueuelen:1000<br /> RX bytes:64241167 (61.2 MiB) TX bytes:498941589 (475.8 MiB)<br /><br /> lo Link encap:Local Loopback<br /> inet addr:127.0.0.1 Mask:255.0.0.0<br /> inet6 addr: ::1/128 Scope:Host<br /> UP LOOPBACK RUNNING MTU:16436 Metric:1<br /> RX packets:18 errors:0 dropped:0 overruns:0 frame:0<br /> TX packets:18 errors:0 dropped:0 overruns:0 carrier:0<br /> collisions:0 txqueuelen:0<br /> RX bytes:980 (980.0 B) TX bytes:980 (980.0 B)<br /><br /> root@slackware:~#<br /></code></td> </tr></table><h3><a name="ping" id="ping"></a>Linux ping command</h3> <p>The ping command is famous not only in Linux system but windows as well. Normally, it is used to check network connection between two hosts. However, ping offers many options in Linux. The ping manual is a good tutorial, make sure you read it.</p> <p>Ok now let's check our network interface with ping. We can try pinging our gateway router if we already in the network but if in standalone pc, ping our own NIC just for practice and look how things work.</p> <p>The ping format is <strong>ping &lt;option&gt; &lt;target ip&gt;</strong>:</p> <table><tr><td><code>root@slackware:~# ping -c3 192.168.1.5<br /> PING 192.168.1.5 (192.168.1.5) 56(84) bytes of data.<br /> 64 bytes from 192.168.1.5: icmp_seq=1 ttl=64 time=0.200 ms<br /> 64 bytes from 192.168.1.5: icmp_seq=2 ttl=64 time=0.287 ms<br /> 64 bytes from 192.168.1.5: icmp_seq=3 ttl=64 time=0.290 ms<br /><br /> --- 192.168.1.5 ping statistics ---<br /><br /> 3 packets transmitted, 3 received, 0% packet loss, time 1998ms<br /> rtt min/avg/max/mdev = 0.200/0.259/0.290/0.041 ms<br /> root@slackware:~#<br /></code></td> </tr></table><p>In the example above, we use ping command with -c3 which means we ping to count and print output three times only.</p> </div></div></div><!-- google_ad_section_end --><div class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above"><div class="field-label">Tags:&nbsp;</div><div class="field-items"><div class="field-item even" rel="dc:subject"><a href="/taxonomy/term/14" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">basic network</a></div></div></div> Tue, 29 Jan 2008 15:34:50 +0000 jinlusuh 109 at http://basicconfig.com http://basicconfig.com/basicnetwork#comments