no save
Assistance
Achat
News

Forum | Linux/Unix
IP forwarding ?
Shopie, le ven. 20 oct. 2006 à 14:08:29
bon je viens aux nouvelles...

ca marche pas :-( mais eth1 n'a pas d'@ IP attribuée par le serveur DHCP de mon modem !!!
et j'ai piqué le script de lami20j :-)

voici les differentes traces effectuées ce midi, ma configuration est elle bonne ?

merci

ma config
---------

modem(192.168.30.1)-----eth1(192.168.30.10)UBUNTU(192.168.0.1)eth0-----(192.168.0.10)BUR0TIC
mon modem fait office de serveur DHCP pour UBUNTU, j'ai installe un serveur DHCP sur UBUNTU pour BUROTIC.

1) route print sous XP
----------------------
===========================================================================
Liste d'Interfaces
0x1 ........................... MS TCP Loopback interface
0x2 ...00 13 d4 29 e9 0c ...... SiS190 100/10 Ethernet Device - Miniport d'ordonnancement de paquets
===========================================================================
===========================================================================
Itinéraires actifs :
Destination réseau Masque réseau Adr. passerelle Adr. interface Métrique
0.0.0.0 0.0.0.0 192.168.30.10 192.168.0.10 20
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
192.168.0.0 255.255.255.0 192.168.0.10 192.168.0.10 20
192.168.0.10 255.255.255.255 127.0.0.1 127.0.0.1 20
192.168.0.255 255.255.255.255 192.168.0.10 192.168.0.10 20
224.0.0.0 240.0.0.0 192.168.0.10 192.168.0.10 20
255.255.255.255 255.255.255.255 192.168.0.10 192.168.0.10 1
Passerelle par défaut : 192.168.30.10
===========================================================================
Itinéraires persistants :
Aucun



2) ipconfig /all sous XP
-------------------------

Configuration IP de Windows

Nom de l'hôte . . . . . . . . . . : maya
Suffixe DNS principal . . . . . . :
Type de noud . . . . . . . . . . : Inconnu
Routage IP activé . . . . . . . . : Non
Proxy WINS activé . . . . . . . . : Non

Carte Ethernet Connexion au réseau local:

Suffixe DNS propre à la connexion :
Description . . . . . . . . . . . : SiS190 100/10 Ethernet Device
Adresse physique . . . . . . . . .: 00-13-D4-29-E9-0C
DHCP activé. . . . . . . . . . . : Non
Adresse IP. . . . . . . . . . . . : 192.168.0.10
Masque de sous-réseau . . . . . . : 255.255.255.0
Passerelle par défaut . . . . . . : 192.168.30.10

3) nano /etc/network/interfaces
-------------------------------

# The loopback network interface
auto lo
iface lo inet loopback

up echo "1">/proc/sys/net/ipv4/ip_forward

# The primary network interface
auto eth1
iface eth1 inet dhcp

# The secondary network interface
auto eth0
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
#gateway 192.168.0.1

4) ifconfig
-----------
eth0 Link encap:Ethernet HWaddr 00:50:BA:B5:6B:CD
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::250:baff:feb5:6bcd/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:366 errors:0 dropped:0 overruns:0 frame:0
TX packets:323 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:33577 (32.7 KiB) TX bytes:57214 (55.8 KiB)
Interrupt:11 Base address:0xdc00

eth1 Link encap:Ethernet HWaddr 00:50:04:ED:41:B5
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:10 Base address:0x4f80

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:78 errors:0 dropped:0 overruns:0 frame:0
TX packets:78 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:6304 (6.1 KiB) TX bytes:6304 (6.1 KiB)

5) 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

6) cat /etc/resolv.conf
-----------------------
search example.org
nameserver 192.168.30.1
nameserver 0.0.0.0

7) iptables -v -L -n
--------------------
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

8) ls -l /etc/init.d/rc.local
-----------------------------
-rwxr--r-- 1 root root 528 2006-10-20 13:04 /etc/init.d/rc.local

9) find /etc/rc* -name '*rc.local'
----------------------------------
/etc/rc2.d/S99rc.local
/etc/rc3.d/S99rc.local
/etc/rc4.d/S99rc.local
/etc/rc5.d/S99rc.local
/etc/rc.local

10) cat /etc/init.d/rc.local
----------------------------
#! /bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin
[ -f /etc/default/rcS ] && . /etc/default/rcS
. /lib/lsb/init-functions

do_start() {
if [ -x /etc/rc.local ]; then
log_begin_msg "Running local boot scripts (/etc/rc.local)"
/etc/rc.local
log_end_msg $?
fi
}

case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
fw.sh

11) more /home/sophie/fw.sh
--------------------------
#! /bin/sh
#
# Description: configuration de firewall netfilter/iptables
#
# Initialization de la table FILTER
#
iptables -F
iptables -X
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP # les 3 cmd = debranchement des cables

# Initialization de la table NAT
#
iptables -t nat -F
iptables -t nat -X
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT
#
# Initialisation de la table MANGLE
#
iptables -t mangle -F
iptables -t mangle -X
iptables -t mangle -P PREROUTING ACCEPT
iptables -t mangle -P INPUT ACCEPT
iptables -t mangle -P OUTPUT ACCEPT
iptables -t mangle -P FORWARD ACCEPT
iptables -t mangle -P POSTROUTING ACCEPT

# interface lo
iptables -A INPUT -i lo -s '0.0.0.0/0' -d '0.0.0.0/0' -j ACCEPT
iptables -A OUTPUT -o lo -s '0.0.0.0/0' -d '0.0.0.0/0' -j ACCEPT

# table FILTER

# chaine INPUT
iptables -A INPUT -i eth0 -d 192.168.0.1 -m state --state ESTABLISHED,RELATED -j ACCEPT

# chaine FORWARD
iptables -A FORWARD -i eth0 -o eth1 -s 0.0.0.0/0 -d 192.168.0.10 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -s 192.168.0.10 -d 192.168.30.0/0 -m state --state ! INVALID -j ACCEPT

# chaine OUTPUT
iptables -A OUTPUT -o eth0 -m state --state ! INVALID -j ACCEPT
iptables -A OUTPUT -o eth1 -m state --state ! INVALID -j ACCEPT

# table NAT
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.0.10 -j SNAT --to-source 192.168.0.1
Précédentkmf31
oct. 06
Shopie
oct. 06
Suivant
REPONSES
lami20j
oct. 06
[Dal]
oct. 06
lami20j
oct. 06
[Dal]
oct. 06
buzz17
oct. 06
Shopie
oct. 06
kmf31
oct. 06
Shopie
oct. 06
Shopie
oct. 06
kelux
oct. 06
Version Web
Réalisé par RedShift
no save