⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 linuxnet.txt

📁 黑客培训教程
💻 TXT
📖 第 1 页 / 共 3 页
字号:
                   :::::::::   ::::::::  :::::::::  :::::::::: 

                   :+:    :+: :+:    :+: :+:    :+: :+:        

                   +:+    +:+ +:+        +:+    +:+ +:+        

                   +#++:++#+  +#++:++#++ +#++:++#:  :#::+::#   

                   +#+    +#+        +#+ +#+    +#+ +#+        

                   #+#    #+# #+#    #+# #+#    #+# #+#        

                   #########   ########  ###    ### ###  



			   http://blacksun.box.sk

  			  

  			  Linux Networking Tutorial

			      By: Ghost_Rider

			 (ghostrider@boxnetwork.net) 



======

Index 

======



.Index

.Intro

.Basics for networking:



- - Ethernet card

  - What should I read?

  - Detection

  - Configuration

  - Making Startup Script



- - LAN

  - What should I read?

  - Setting up LAN

  - Making some configs



- - IP masquerading: 

   - What should I read?

   - What is that?

   - How does it work?

   - Configuration  

   - Security 

   

.Things you should also know: 



- - Remote Port Fowarding

  - What should I read?

  - Why do I want this?

  - Configuration

  - Security



- - Transparent Proxy:

   - What should I read?

   - What is it?

   - How can I support it?

   - Configuration



- - NFS

  - What should I read?

  - What is it?

  - Is it really usefull?

  - Configuration

  - Security 



.Final notes



Intro

=====



 Hello, here I am again, after sometime of inactivity I'm back to the article writing life, this time I'll talk about Linux Networking. This is the tutorial that was promissed when I was setting up a lecture about the same topic. The index you've just read was my plan file for that lecture, with some little alterations. In this tutorial my goals are to explain better, with examples, and giving places to get more information about each topic, so in a way we can say that each one, the lecture and the tutorial are standalone but still both can complete each other. Besides, due to 

problems of time constraints, the lecture was kinda cut off short. I didn't have the time to talk anything about Transparent Proxy and the NFS topic which had to be described in about 7-10 lines. Here you'll find more indepth information on those two topics. I think it's enough of intro and we should just start getting our reading.  Good reading...

 

      								Ghost_Rider

								

								

								

.Basics for Networking



 



Ethernet Cards

==============





 What should I read?

 -------------------

 

 

   Setting up ethernet cards won't give you much problems, unless the NIC's

chip isn't supported. In this topic I advice you to read:



    . Ethernet HOWTO  - if you installed the HOWTOs check /usr/doc/

                        otherwise go to

                   http://www.linuxdoc.org/HOWTO/Ethernet-HOWTO.html





 Detection

 ---------

 

  To be perfectly honest with you, all the ethernet cards I've used 

got detected, and if you get a ethernet card not-detected I really

dunnow what to do, the only thoughts about that kind of problem is that

your card isn't supported, check section 5 at the ethernet-howto, still I

might be wrong. 

  But here is the way to see if your card is really detected:





   . If your card is ISA as root type isapnp > ./dump (make sure there's no

file ./dump) now just go inspect the dump file, and check for the string

that defines your ethernet card like "Accton EN1666..."  or you can just

check by card number. On boot-up right after the RAM check the ISA cards are detected by BIOS and you'll see something:



   CARD 1 something

   CARD 2 ethernet card bla bla bla

   

   So you just have to check if card 2 is listen on isapnp.

   If your ethernet card is listed by your isapnp kernel detected it.

   

    . If you card is pci as root type cat /proc/pci > ./pci (once more make

sure there's no ./pci) and inspect the ./pci file looking for your ethernet

card. It should show up something like Ethernet Controller: ...



     Remember even if your card is detected it doesn't mean that is

supported. We now know that our ethernet card is detected. Next step...

     



...Configuration

-----------------

       

   To configure your card you have to know what kernel module supports your

ethernet card, the best way to know what module supports your card is by

knowing what chip it uses. Checking the documentation that comes with your

ethernet card might help. Otherwise, if no documentation is available or it

isn't documentated what kind of chip it uses, you can check section 5. of

the ethernet howto or read the help of each ethernet card kernel module they tell the major chips they support.

   If it's ISA all this work might be reduced, since all ISA cards are

NE2000 compatible so you can just install the kernel modules for it and load ne.o module. On the otherhand PCI cards are not that regular, still if 

you stick to cards from 3com, SMC (old accton) or realteak you'll be making

you kernel module selection much easier. If you are still thinking in buying your NICs (network interface cards, the ethernet card) I advice you to give a look at the ethernet howto and check for the supported cards.

   I just have messed with actton cards. I have 2 ISA EN1666 which I had any problems at all setting them up and one EN2242 on my laptop which is PCI and uses DECchip, now the kernel module for DECchip support doesn't act well with this card so you have to download a newer version of that module and compile it. At the time I'm writting this article kernel 2.4.x (right now on 2.4.1) doesn't have the driver that supports it. (Search on google for EN2242 with linux if you need the module, you'll find a page that talks

about how to setup linux on a Omini HP laptop they have their the module

version that supports it).



   So you finally found out that you module is that nice xpto module xpto.o

   What you have to do is just load the module using modprobe.

   

   root@ExampleBox: ~# /sbin/modprobe xpto

   root@ExampleBox: ~# /sbin/lsmod

   Module   Size   Used  By

   xpto     xxxx    1

   

   Your NIC's module is loaded so you now have a new interface the eth0, you can make sure of it doing



   root@ExampleBox: ~# /sbin/ifconfig

   

      lo: (...)

      

      eth0: (...)

      

   Or if you just checking the /proc directly doing

   

   root@ExampleBox: ~# cat /proc/net/dev

   

   And it also has to be listed the eth0 interface besides the lo. 

   But it's better to use ifconfig in my opinion, because you can check

card's status. To make sure your NIC is active check for a line like



   UP BROADCAST RUNNING MULTICAST

   or

   BROADCAST MULTICAST

   

   Now if your case is the 1st one there is no problem, the card is already

active, but if 2nd you have to start the card to do this you use once more

ifconfig giving the command



     root@ExampleBox: ~# /sbin/ifconfig eth0 up

     

   We now have a 100% working card, but we aren't, yet, able to send or

receive data from a LAN. This is because we still didn't gave an IP address

to the ethernet card. Since we are talking about a LAN@home we can use the

reserved IPs for LANs those are:



    - 10.0.0.0/8

    - 172.16.0.0/12

    - 192.168.0.0/24

    

    These address are unrouted from the internet, they are for intranet use

only. 



- ------SIDE NOTE------

You already should know this but since I'm talking about IPs I'll also

talk about what are those /number after each ip. Well to understand it you just have to know 2 simple things, there are mainly 3 types of IP address: 

    - Class A which are IPs XXX.abc.abc.abc 

    - Class B which are IPs XXX.YYY.abc.abc 

    - Class C which are IPs XXX.YYY.ZZZ.abc 

  Where: 

  the upper case letters are the ones that represent the network they are called the NETWORK ID.

  the lower case letters are the ones that define the host, they are called the HOST ID.

  

  This means that in the same network all hosts will have the same network ID.  Now if you realized in a IP X.X.X.X  0 < X < 255, and the higher value

that 1byte can store is, yes, 255. So each X is 1byte. Since 1 byte = 8 bits the /X number tells you how many bits are fixed that way you can know what network Class we are talking about without having it's netmask. 

   8 bits = 1 byte so the 1st octect if fixed the other 3 changes Class A

  16 bits = 2 bytes so the 1st and the 2nd octect are fixed the other 2

changes Class B  24 bits = 3 bytes so the all octects are fixed except the last one Class C   32 bits = all octects are fixed, so this means we are talking about a single IP, no network now.

  12 bits = 1bytes + 4bits this as no special Class name it's a type of

Class B it means that the 2nd octect can be between 16 and 32

- ---------------



 Since we are talking about a simple LAN@home we gonna setup a Class C

address this will allow us to set hosts up to 253 hosts. More than enough.

So let's say we want to give the IP 192.168.0.1 to one of our boxes, once

more we would use ifconfig.

  

  root@ExampleBox: ~/# /sbin/ifconfig eth0 192.168.0.1 netmask 255.255.255.0

  

  After you type that command you'll probably have another routing entry on

your route table, still it's better to check



  root@ExampleBox: ~/# /sbin/route -n 

  Kernel IP routing table

  Destination     Gateway     Genmask        Flags    Metric  Ref   Use  Iface

  192.168.0.0     0.0.0.0     255.255.255.0  U        0       0     0    eth0

  127.0.0.0       0.0.0.0     255.0.0.0      U        0       0     0    lo

  

  If the 192.168.0.0 entry wasn't automatically added you have to add it. 

  

  root@ExampleBox: ~# /sbin/route add 192.168.0.0 netmask 255.255.255.0 dev 

eth0



  And there you go, you have a fully configured ethernet card you can now

test your LAN. (will take care of this in the next topic LAN)

 

 

 

 Startup Script

 --------------

 

 

 #!/bin/sh

 # Simple Startup Script

 # for linux networking tutorial

 # by Ghost_Rider

 # NOTE: if you wanna use this script change MODULE to your NIC's module

 #       and IP to the NIC's IP.

 

 echo "Starting up Ethernet Interface"

 /sbin/modprobe MODULE

 /sbin/ifconfig eth0 IP netmask 255.255.255.0 

 

 

 

 LAN

 ===

 

   What Should I read?

   -------------------

   

       . Networking HOWTO

          If howtos were installed check /usr/doc/ and look for the howto dir  or go to http://www.linuxdoc.org/HOWTO/Net-HOWTO/index.html

	  

	  

   Setting up the LAN

   ------------------

   

    You now have the computers configured each one with it's one 192.168.0.x IP and the route entry for 192.168.0.0 it's now time to connect the computers and see if everything is working. I'm assuming that you are using RJ-45 connectors (those ISDN plugs)instead of BNC (connectors like the ones from your TV cable).



     Example 1:

          

       Host1 eth0 (192.168.0.1) <---> eth0 Host2 (192.168.0.2)

       

       Now this is a direct ethernet to ethernet connection. In this case

you'll have to use a crossover cable instead of a CAT3 or CAT5 cable. Why?

 

       RJ-45 uses 2 wire pares. Check the following diagram to understand

why you have to use crossover

     Connectors of each card:

     ------ +       + -------   Where - and + are the polarity of each  

     ------ -       - -------   connector now since you can't connect + with + 

     ------ +       + -------   or - with - you'll have to make a crossover to

     ------ -       - -------   make + connect to - so the signal could be

                                sent throught the line(this is

                                electricity/electronic).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -