Urcite kazdy z Vas rozmyslal, ako sa najlacnejsie pripojit k internetu. Momentalne je jednou z najlacnejsich alternativ pripojenie cez wifi...
Nasa situacia je:
LAN siet:
PC1 192.168.0.11
PC2 192.168.0.12
PC3 192.168.0.13
Server s nainstalovanym OS Linux/Unix, kernel-2.4.22 Wifi karta s PRISM II chipsetom
Najprv potrebujeme rozbehat Wifi a Ethernet karty, co dosiahneme prekompilovanim jadra. Jadro si stiahneme z www.kernel.org a ulozime ho do adresara /usr/src.
Rozpakujeme jadro
bzip2 -c linux-2.4.22.tar.bz2
tar xvf linux-2.4.22.tar
Otvorime adresar s jadrom. Pozn. pri neskorsej kompilacii nejakych programov bodne vytvorit si link z linux-
2.4.22 na linux.
ln -s linux-2.4.22 linux
cd linux
Zacneme s konfiguraciou jadra.
make menuconfig
Najviac nas bude zaujimat polozka Networking Options
* Packet socket
* Network packet filtering
* Unix domain socket
* TCP/IP networking
* IP: multicasting
IP: Netfilter configuration: #veci potrebne pre rozbehanie maskarady
* Connection tracking
* FTP protocol support
* IP tables support
* Limit match support
* MAC address support
* Packet type match support
* netfilter MARK support
* Multiple port match support
* Connection state match support
* Connection tracking match support
* Packet filtering
* REJECT target support
* Full NAT
* MASQUERADE target support
* NAT of local connections
* Packet mangling
* MARK target suppport
Network device support: #ovladace sietoviek
* Network device support
Ethernet (10 or 100 Mbit):
pozn. typ sietovej karty zistime prikazom lspci a podla toho si zaskrtneme co potrebujeme.
Wirelless LAN:
* Hermes chipset 802.11b support
Zvysok veci podla vlastneho uvazenia ;-
Ak mame jadro nakonfigurovane mozme zacat kompilovat.
make dep
make bzImage
make modules
make modules_install
Skopirujeme novy image jadra do adresara boot.
cp arch/i386/boot/bzImage /boot/bzImage
Editneme subor /etc/lilo.conf a dopiseme tam:
image=/boot/bzImage
root=/dev/hda1
label=<nazov_noveho_jadra>
read-only
Riadok default=linux prepiseme na default=<nazov_noveho_jadra>, aby sa nam pri reboote spustalo nove jadro.
Preinstalujeme lilo a rebootneme pocitac do noveho jadra:
lilo
Pozrieme si prikaz dmesg. Malo by nam najst sietovu a wifi kartu. Nastavime ip adresu sietovej karty.
ifconfig eth0 192.168.0.1
ifconfig eth0 up
Stiahneme ovladac pre Wifi kartu. Ja som pouzil ovladac HostAP, ktory sa da stiahnut
na http://hostap.epitest.fi.
Instalacia ovladaca:
tar zxvf hostap-0.0.4.tar.gz
cd hostap-0.0.4
make pci
make install_pci
Prikazom modprobe hostap_pci zistime ci nam v pohode bezi nasa wifi karta. Ak je vsetko v pohode nahodime ip adresu.
ifconfig wlan0 <ip_adresa_pridelena_providerom>
ifconfig wlan0 up
Na nastavenie SSID a kanalu pouzijeme utilitku wirelles_tools.
iwconfig wlan0 SSID \"SSID_providera\"
iwconfig wlan0 mode managed
Momentalne by nam uz na serveri mal bezat internet. Ostava uz len nastavit rutrovanie a maskaradu.
Sporoznenie rutrovania:
route add default gw <ip_gateway> metric 1
Nastavenie maskarady:
#zakazat FORWARD
iptables -P FORWARD DROP
#povolit forwardovanie z eth0 na wlan0
iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT
#forwardne vsetko z wlan0 na eth0
iptables -A FORWARD -i wlan0 -o eth0 -m state --state ESTABLISHED,RELATED -j AC
CEPT
#maskarada
iptables -A POSTROUTING -t nat -o wlan0 -j MASQUERADE
Tak a to by bolo vsetko. Netreba vsak zabudnut, ze vsetky nastavenia musime mat
ulozene v suboroch, napr. v /etc/rc.d/rc.local.alwarez