auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
up route add -net 158.193.83.90 netmask 255.255.255.0 gw 192.168.1.1
down route del -net 158.193.83.90 netmask 255.255.255.0 gw 192.168.1.1
moja externa IP je 158.193.82.90 a pripajam sa na siet cez DHCP a klijenta som nastavil nasledovne
IP Adresa : 192.168.1.2
Maska : 255.255.255.0
Brána : 192.168.1.1
DNS : 192.168.1.1
sietovkov ktorov sa pripajam do inretnetu je eth1 do internej site je sietovka eth0 co mam este nastavit aby mi to fungovalo klijent mi pise ze je pripojeny, aj mi aj preklad mien funguje ale ked chcem pingnut neaky server tak nemozem ale server mozem pingnut v pohode co mam este nastavit ?? dik
down route del -net 158.193.82.90 netmask 255.255.255.0 gw 192.168.1.1
prepacte v configu mam tieto riadky
ip route show
192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.1
192.168.0.0/24 dev eth1 proto kernel scope link src 192.168.0.1
158.193.82.0/24 dev eth0 proto kernel scope link src 158.193.82.90
default via 158.193.83.254 dev eth0
ping 192.168.0.1 -c3
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.056 ms
64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=0.036 ms
64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.027 ms
--- 192.168.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.027/0.039/0.056/0.014 ms
a este
ifconfig
eth0 Link encap:Ethernet HWaddr 00:4F:4E:16:E4:CF
inet addr:158.193.82.90 Bcast:158.193.82.255 Mask:255.255.255.0
inet6 addr: fec0::8:24f:4eff:fe16:e4cf/64 Scope:Site
inet6 addr: 2002:9ec1:5f89:8:24f:4eff:fe16:e4cf/64 Scope:Global
inet6 addr: fe80::24f:4eff:fe16:e4cf/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:324667 errors:0 dropped:0 overruns:0 frame:0
TX packets:149185 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:408426761 (389.5 MiB) TX bytes:9780543 (9.3 MiB)
Interrupt:177 Base address:0xc800
eth1 Link encap:Ethernet HWaddr 00:0E:2E:61:F5:DC
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20e:2eff:fe61:f5dc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2536 errors:0 dropped:0 overruns:0 frame:0
TX packets:632 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:485820 (474.4 KiB) TX bytes:49946 (48.7 KiB)
Interrupt:185 Base address:0xc400
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:3472 errors:0 dropped:0 overruns:0 frame:0
TX packets:3472 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:149468 (145.9 KiB) TX bytes:149468 (145.9 KiB)
dufam ze som tu dal vsetky potreble informacie
ping google.com
ping 64.233.167.99
ping6 ipv6.google.com
a mozes si skusit aj traceroute (traceroute6)
iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
a ping nemoze nic naist ale iba na klijentovy vo vnutry siete a servery to ide v pohode
pre istotu skus vsetko este raz, lebo ja vobec nechapem co robis, co ti ide a co nie
/etc/init.d/networking restart
Reconfiguring network interfaces...There is already a pid file /var/run/dhclient .eth0.pid with pid 2871
killed old client process, removed PID file
Internet Systems Consortium DHCP Client V3.0.4
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Listening on LPF/eth0/00:4f:4e:16:e4:cf
Sending on LPF/eth0/00:4f:4e:16:e4:cf
Sending on Socket/fallback
DHCPRELEASE on eth0 to 158.193.82.6 port 67
Internet Systems Consortium DHCP Client V3.0.4
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Listening on LPF/eth0/00:4f:4e:16:e4:cf
Sending on LPF/eth0/00:4f:4e:16:e4:cf
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
DHCPOFFER from 158.193.82.6
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 158.193.82.6
bound to 158.193.82.90 -- renewal in 18479 seconds.
/bin/sh: ruote: command not found
Failed to bring up eth1.
done.
preco tam mas tieto riadky ?
up route add -net 158.193.83.90 netmask 255.255.255.0 gw 192.168.1.1
down route del -net 158.193.83.90 netmask 255.255.255.0 gw 192.168.1.1
server vyzera ze mas nastaveny ok. ak sa z neho dostanes do sveta tak je to ok. skontroluj si ci mas hore aj druhy interface (smerom do lan).
skus pingnut nejakeho hosta v lan
potom cez iptables zapni maskaradu :
iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
Na hostoch potom nastav ako default gw ip interfacu na lan strane a DNS server taky isty ako server. A ked ti toto pojde zacni sa hrat s dhcp