Problème avec iptables pour portforward

Bonjour à tous,

Je suis dans l’impasse la plus totale, et après moult recherches et nuits blanches je me résoud à vous demander de l’aide :slightly_smiling:

Mon soucis c’est que j’essaye de faire le forward d’un port 81 ouvert sur une interface ppp0 vers une ip de mon réseau local. Les pings passent sans problème du serveur jusqu’a l’ip de destination, ce qui exclu tout problème réseau, et en interne, toute connection sur le port 81 de l’ip de destination marche. L’ip de destination est 192.168.2.2 et donc le port 81.

Alors j’ai installé le noyeau debian de base de la nouvelle version, a savoir le 2.6.18.5 dans lequel tous les modules pour faire du port forward sont activés. j’ai installé iptables avec un petit apt-get, iptables v1.3.6.

Et j’ai ensuite repris le même script que j’ai déjà utilisé très souvents sur plein de serveurs/routeurs linux où le port forward marche sans soucis.

Je vous le copie ici :
#!/bin/sh

Flush all tables

iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
echo “Remise à 0 ok”

Ip Masquerading

iptables -t nat -A PREROUTING -i eth0 -j ACCEPT
echo "Prerouting OK"
iptables -A POSTROUTING -t nat -o ppp0 -j MASQUERADE
echo “masquerading OK”

#Port forward Exchange
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 81 -j DNAT --to 192.168.2.2:81
iptables -t nat -A POSTROUTING -o tun0 -p tcp --sport 81 -j SNAT --to 192.168.2.2:81
iptables -A INPUT -p tcp --dport 81 -j ACCEPT

iptables -A FORWARD -p tcp --destination-port 81 -m state --state NEW,INVALID -j ACCEPT
iptables -A FORWARD -p tcp --source-port 81 -m state --state RELATED -j ACCEPT

Fin port forward emule bastien

echo "port forward OK"
echo 1 > /proc/sys/net/ipv4/ip_forward
echo “Masquerading OK”

Hé bien, croyez le ou non, j’ai beau réutiliser exactement le même script que sur d’autres serveurs ou je l’ai tout fonctionnel, rien n’y fait. A chaque fois le port 81 apparait en “filtered” dans un nmap. J’ai tenté de faire le script avec d’autres pots 80, 82, 3, etc, mais toujours la même chose. Les ports passent inexplicablement en “filtered”. Cela semble donc provenir d’un problème du noyeau, mais le kernel standard est censé être foncionnel de base.

Quelqu’un aurai-t-il des idées ? Quels modules il me manquerait ou mauvaise config de mon scrip iptables ?

Merci

Pour vous aider :
srv-plouf:~# iptables -V
iptables v1.3.6
srv-plouf:~# uname -a
Linux srv-plouf 2.6.18.5 #2 SMP Mon Nov 12 17:00:02 CET 2007 i686 GNU/Linux

dmesg:
Linux version 2.6.18.5 (root@debian) (gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)) #2 SMP Mon Nov 12 17:00:02 CET 2007
BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000e4000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000001fe90000 (usable)
BIOS-e820: 000000001fe90000 - 000000001fe9e000 (ACPI data)
BIOS-e820: 000000001fe9e000 - 000000001fee0000 (ACPI NVS)
BIOS-e820: 000000001fee0000 - 000000001ff00000 (reserved)
BIOS-e820: 00000000ffb80000 - 0000000100000000 (reserved)
510MB LOWMEM available.
found SMP MP-table at 000ff780
On node 0 totalpages: 130704
DMA zone: 4096 pages, LIFO batch:0
Normal zone: 126608 pages, LIFO batch:31
DMI 2.3 present.
ACPI: RSDP (v000 ACPIAM ) @ 0x000fafe0
ACPI: RSDT (v001 NEC 0x11000630 MSFT 0x00000097) @ 0x1fe90000
ACPI: FADT (v001 A_M_I_ OEMFACP 0x11000630 MSFT 0x00000097) @ 0x1fe90200
ACPI: MADT (v001 A_M_I_ OEMAPIC 0x11000630 MSFT 0x00000097) @ 0x1fe90390
ACPI: SLIC (v001 NEC 0x11000630 MSFT 0x00000097) @ 0x1fe90410
ACPI: OEMB (v001 A_M_I_ AMI_OEM 0x11000630 MSFT 0x00000097) @ 0x1fe9e040
ACPI: HPET (v001 A_M_I_ OEMHPET 0x11000630 MSFT 0x00000097) @ 0x1fe95ce0
ACPI: MCFG (v001 A_M_I_ OEMMCFG 0x11000630 MSFT 0x00000097) @ 0x1fe95d20
ACPI: DSDT (v001 A0643 A0643000 0x00000000 INTL 0x20060113) @ 0x00000000
ACPI: PM-Timer IO Port: 0x808
ACPI: Local APIC address 0xfee00000
ACPI: LAPIC (acpi_id[0x01] lapic_id[0x00] enabled)
Processor #0 15:6 APIC version 20
ACPI: LAPIC (acpi_id[0x02] lapic_id[0x81] disabled)
ACPI: LAPIC (acpi_id[0x03] lapic_id[0x82] disabled)
ACPI: LAPIC (acpi_id[0x04] lapic_id[0x83] disabled)
ACPI: IOAPIC (id[0x01] address[0xfec00000] gsi_base[0])
IOAPIC[0]: apic_id 1, version 32, address 0xfec00000, GSI 0-23
ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
ACPI: IRQ0 used by override.
ACPI: IRQ2 used by override.
ACPI: IRQ9 used by override.
Enabling APIC mode: Flat. Using 1 I/O APICs
ACPI: HPET id: 0x8086a201 base: 0xfed00000
Using ACPI (MADT) for SMP configuration information
Allocating PCI resources starting at 20000000 (gap: 1ff00000:dfc80000)
Detected 3066.797 MHz processor.
Built 1 zonelists. Total pages: 130704
Kernel command line: auto BOOT_IMAGE=Linux ro root=801
mapped APIC to ffffd000 (fee00000)
mapped IOAPIC to ffffc000 (fec00000)
Enabling fast FPU save and restore… done.
Enabling unmasked SIMD FPU exception support… done.
Initializing CPU#0
PID hash table entries: 2048 (order: 11, 8192 bytes)
Console: colour VGA+ 80x25
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 506776k/522816k available (4163k kernel code, 15520k reserved, 1703k data, 340k init, 0k highmem)
Checking if this processor honours the WP bit even in supervisor mode… Ok.
hpet0: at MMIO 0xfed00000 (virtual 0xe0800000), IRQs 2, 8, 0
hpet0: 3 64-bit timers, 14318180 Hz
Using HPET for base-timer
Calibrating delay using timer specific routine… 6138.76 BogoMIPS (lpj=12277526)
Security Framework v1.0.0 initialized
SELinux: Disabled at boot.
Capability LSM initialized
Mount-cache hash table entries: 512
CPU: After generic identify, caps: bfebfbff 20000000 00000000 00000000 0000e41d 00000000 00000001
CPU: After vendor identify, caps: bfebfbff 20000000 00000000 00000000 0000e41d 00000000 00000001
monitor/mwait feature present.
using mwait in idle threads.
CPU: Trace cache: 12K uops, L1 D cache: 16K
CPU: L2 cache: 512K
CPU: Hyper-Threading is disabled
CPU: After all inits, caps: bfebfbff 20000000 00000000 00000180 0000e41d 00000000 00000001
Intel machine check architecture supported.
Intel machine check reporting enabled on CPU#0.
CPU0: Intel P4/Xeon Extended MCE MSRs (24) available
CPU0: Thermal monitoring enabled
Compat vDSO mapped to ffffe000.
Checking ‘hlt’ instruction… OK.
SMP alternatives: switching to UP code
Freeing SMP alternatives: 24k freed
ACPI: Core revision 20060707
CPU0: Intel® Celeron® D CPU 3.06GHz stepping 05
Total of 1 processors activated (6138.76 BogoMIPS).
ENABLING IO-APIC IRQs
…TIMER: vector=0x31 apic1=0 pin1=2 apic2=-1 pin2=-1
Brought up 1 CPUs
migration_cost=0
checking if image is initramfs… it is
Freeing initrd memory: 4385k freed
NET: Registered protocol family 16
ACPI: bus type pci registered
PCI: BIOS Bug: MCFG area at f0000000 is not E820-reserved
PCI: Not using MMCONFIG.
PCI: PCI BIOS revision 2.10 entry at 0xf0031, last bus=2
PCI: Using configuration type 1
Setting up standard PCI resources
ACPI: Interpreter enabled
ACPI: Using IOAPIC for interrupt routing
ACPI: PCI Root Bridge [PCI0] (0000:00)
PCI: Probing PCI hardware (bus 00)
Boot video device is 0000:00:02.0
PCI: Ignoring BAR0-3 of IDE controller 0000:00:1f.1
PCI: Transparent bridge - 0000:00:1e.0
ACPI: PCI Interrupt Routing Table [_SB_.PCI0.PRT]
ACPI: PCI Interrupt Routing Table [_SB
.PCI0.P0P3.PRT]
ACPI: PCI Interrupt Routing Table [_SB
.PCI0.P0P9._PRT]
ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 6 7 10 11 12 14 15)
ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 5 6 7 10 11 12 14 15)
ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 5 6 7 10 11 12 14 15)
ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 5 6 7 10 11 12 14 15)
ACPI: PCI Interrupt Link [LNKE] (IRQs 3 4 5 6 7 10 11 12 14 15)
ACPI: PCI Interrupt Link [LNKF] (IRQs 3 4 5 6 7 10 11 12 14 15) 0, disabled.
ACPI: PCI Interrupt Link [LNKG] (IRQs 3 4 5 6 7 10 11 12 14 15) 0, disabled.
ACPI: PCI Interrupt Link [LNKH] (IRQs 3 4 5 6 7 10 11 12 14 15)
Linux Plug and Play Support v0.97 © Adam Belay
pnp: PnP ACPI init
pnp: PnP ACPI: found 18 devices
PnPBIOS: Disabled by ACPI PNP
SCSI subsystem initialized
PCI: Using ACPI for IRQ routing
PCI: If a device doesn’t work, try “pci=routeirq”. If it helps, post a report
Sangoma WANPIPE Router v1.1 © 1995-2000 Sangoma Technologies Inc.
pnp: 00:08: ioport range 0x290-0x297 has been reserved
PCI: Ignore bogus resource 6 [0:0] of 0000:00:02.0
PCI: Bridge: 0000:00:1c.0
IO window: e000-efff
MEM window: disabled.
PREFETCH window: disabled.
PCI: Bridge: 0000:00:1e.0
IO window: d000-dfff
MEM window: dff00000-dfffffff
PREFETCH window: 20000000-200fffff
ACPI: PCI Interrupt 0000:00:1c.0[A] -> GSI 16 (level, low) -> IRQ 169
PCI: Setting latency timer of device 0000:00:1c.0 to 64
PCI: Setting latency timer of device 0000:00:1e.0 to 64
NET: Registered protocol family 2
IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
TCP established hash table entries: 16384 (order: 5, 131072 bytes)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 16384 bind 8192)
TCP reno registered
Machine check exception polling timer started.
IA-32 Microcode Update Driver: v1.14a tigran@veritas.com
scx200: NatSemi SCx200 Driver
audit: initializing netlink socket (disabled)
audit(1194886768.748:1): initialized
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
Installing knfsd (copyright © 1996 okir@monad.swb.de).
NTFS driver 2.1.27 [Flags: R/W].
fuse init (API version 7.7)
Initializing Cryptographic API
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
PCI: Setting latency timer of device 0000:00:1c.0 to 64
assign_interrupt_mode Found MSI capability
Allocate Port Service[0000:00:1c.0:pcie00]
Allocate Port Service[0000:00:1c.0:pcie02]
isapnp: Scanning for PnP cards…
isapnp: No Plug & Play device found
hpet_resources: 0xfed00000 is busy
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
00:0d: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
Intel® PRO/1000 Network Driver - version 7.1.9-k4-NAPI
Copyright © 1999-2006 Intel Corporation.
ns83820.c: National Semiconductor DP83820 10/100/1000 driver.
ACPI: PCI Interrupt 0000:01:04.0[A] -> GSI 20 (level, low) -> IRQ 193
skge 1.6 addr 0xdfffc000 irq 193 chip Yukon-Lite rev 9
skge eth0: addr 00:1a:92:93:fd:11
PPP generic driver version 2.4.2
PPP Deflate Compression module registered
PPP BSD Compression module registered
NET: Registered protocol family 24
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
ICH7: IDE controller at PCI slot 0000:00:1f.1
ACPI: PCI Interrupt 0000:00:1f.1[A] -> GSI 22 (level, low) -> IRQ 201
ICH7: chipset revision 1
ICH7: not 100% native mode: will probe irqs later
ide0: BM-DMA at 0xffa0-0xffa7, BIOS settings: hda:DMA, hdb:pio
ide1: BM-DMA at 0xffa8-0xffaf, BIOS settings: hdc:pio, hdd:pio
Probing IDE interface ide0…
hda: TSSTcorp CDW/DVD SH-M522C, ATAPI CD/DVD-ROM drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
Probing IDE interface ide1…
Probing IDE interface ide1…
hda: ATAPI 52X DVD-ROM CD-R/RW drive, 1536kB Cache, UDMA(33)
Uniform CD-ROM driver Revision: 3.20
ide-floppy driver 0.99.newide
Loading iSCSI transport class v1.1-646.<5>iscsi: registered transport (tcp)
Loading Adaptec I2O RAID: Version 2.4 Build 5go
Detecting Adaptec I2O RAID controllers…
Adaptec aacraid driver (1.1-5[2409]-mh2)
scsi: Detection failed (no card)
NCR53c406a: no available ports found
Failed initialization of WD-7000 SCSI card!
megaraid cmm: 2.20.2.7 (Release Date: Sun Jul 16 00:01:03 EST 2006)
megaraid: 2.20.4.9 (Release Date: Sun Jul 16 12:27:22 EST 2006)
megasas: 00.00.03.01 Sun May 14 22:49:52 PDT 2006
3ware Storage Controller device driver for Linux v1.26.02.001.
3ware 9000 Storage Controller device driver for Linux v2.26.02.007.
libata version 2.00 loaded.
ata_piix 0000:00:1f.2: version 2.00
ata_piix 0000:00:1f.2: MAP [ P0 P2 P1 P3 ]
ACPI: PCI Interrupt 0000:00:1f.2[B] -> GSI 23 (level, low) -> IRQ 209
PCI: Setting latency timer of device 0000:00:1f.2 to 64
ata1: SATA max UDMA/133 cmd 0xC800 ctl 0xC402 bmdma 0xB400 irq 209
ata2: SATA max UDMA/133 cmd 0xC000 ctl 0xB802 bmdma 0xB408 irq 209
scsi2 : ata_piix
ata1.00: ATA-7, max UDMA/133, 156301488 sectors: LBA48 NCQ (depth 0/32)
ata1.00: ata1: dev 0 multi count 16
ata1.00: configured for UDMA/133
scsi3 : ata_piix
ATA: abnormal status 0x7F on port 0xC007
Vendor: ATA Model: ST380811AS Rev: 3.AA
Type: Direct-Access ANSI SCSI revision: 05
RocketRAID 3xxx SATA Controller driver v1.0 (060426)
SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
sda: Write Protect is off
sda: Mode Sense: 00 3a 00 00
SCSI device sda: drive cache: write back
SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
sda: Write Protect is off
sda: Mode Sense: 00 3a 00 00
SCSI device sda: drive cache: write back
sda: sda1 sda2 < sda5 >
sd 2:0:0:0: Attached scsi disk sda
sd 2:0:0:0: Attached scsi generic sg0 type 0
SCSI Media Changer driver v0.25
PNP: PS/2 Controller [PNP0303:PS2K] at 0x60,0x64 irq 1
PNP: PS/2 controller doesn’t have AUX irq; using default 12
serio: i8042 AUX port at 0x60,0x64 irq 12
serio: i8042 KBD port at 0x60,0x64 irq 1
mice: PS/2 mouse device common for all mice
pktgen v2.67: Packet Generator for packet performance testing.
NET: Registered protocol family 26
GACT probability on
Mirror/redirect action on
Simple TC action Loaded
netem: version 1.2
u32 classifier
Performance counters on
input device check on
Actions configured
Netfilter messages via NETLINK v0.30.
IPv4 over IPv4 tunneling driver
GRE over IPv4 tunneling driver
ip_conntrack version 2.4 (4084 buckets, 32672 max) - 228 bytes per conntrack
input: AT Translated Set 2 keyboard as /class/input/input0
ip_conntrack_pptp version 3.1 loaded
ip_nat_pptp version 3.0 loaded
ip_tables: © 2000-2006 Netfilter Core Team
arp_tables: © 2002 David S. Miller
TCP bic registered
TCP cubic registered
TCP westwood registered
TCP highspeed registered
TCP hybla registered
TCP htcp registered
TCP vegas registered
TCP veno registered
TCP scalable registered
TCP lp registered
Initializing IPsec netlink socket
NET: Registered protocol family 1
NET: Registered protocol family 10
lo: Disabled Privacy Extensions
IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
NET: Registered protocol family 15
Bridge firewalling registered
NET: Registered protocol family 4
NET4: DECnet for Linux: V.2.5.68s © 1995-2003 Linux DECnet Project Team
DECnet: Routing cache hash table of 1024 buckets, 8Kbytes
NET: Registered protocol family 12
802.1Q VLAN Support v1.8 Ben Greear greearb@candelatech.com
All bugs added by David S. Miller davem@redhat.com
ieee80211: 802.11 data/management/control stack, git-1.1.13
ieee80211: Copyright © 2004-2005 Intel Corporation jketreno@linux.intel.com
ieee80211_crypt: registered algorithm 'NULL’
ieee80211_crypt: registered algorithm 'WEP’
ieee80211_crypt: registered algorithm 'CCMP’
Using IPI Shortcut mode
BIOS EDD facility v0.16 2004-Jun-25, 1 devices found
Freeing unused kernel memory: 340k freed
Time: tsc clocksource has been installed.
kjournald starting. Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
usbcore: registered new driver usbfs
usbcore: registered new driver hub
USB Universal Host Controller Interface driver v3.0
ACPI: PCI Interrupt 0000:00:1d.0[A] -> GSI 20 (level, low) -> IRQ 193
PCI: Setting latency timer of device 0000:00:1d.0 to 64
uhci_hcd 0000:00:1d.0: UHCI Host Controller
uhci_hcd 0000:00:1d.0: new USB bus registered, assigned bus number 1
uhci_hcd 0000:00:1d.0: irq 193, io base 0x0000a000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
ACPI: PCI Interrupt 0000:00:1d.1[B] -> GSI 17 (level, low) -> IRQ 217
PCI: Setting latency timer of device 0000:00:1d.1 to 64
uhci_hcd 0000:00:1d.1: UHCI Host Controller
uhci_hcd 0000:00:1d.1: new USB bus registered, assigned bus number 2
uhci_hcd 0000:00:1d.1: irq 217, io base 0x0000a400
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
ACPI: PCI Interrupt 0000:00:1d.2[C] -> GSI 18 (level, low) -> IRQ 225
PCI: Setting latency timer of device 0000:00:1d.2 to 64
uhci_hcd 0000:00:1d.2: UHCI Host Controller
uhci_hcd 0000:00:1d.2: new USB bus registered, assigned bus number 3
uhci_hcd 0000:00:1d.2: irq 225, io base 0x0000a800
usb usb3: configuration #1 chosen from 1 choice
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 2 ports detected
ACPI: PCI Interrupt 0000:00:1d.3[D] -> GSI 19 (level, low) -> IRQ 233
PCI: Setting latency timer of device 0000:00:1d.3 to 64
uhci_hcd 0000:00:1d.3: UHCI Host Controller
uhci_hcd 0000:00:1d.3: new USB bus registered, assigned bus number 4
uhci_hcd 0000:00:1d.3: irq 233, io base 0x0000b000
usb usb4: configuration #1 chosen from 1 choice
hub 4-0:1.0: USB hub found
hub 4-0:1.0: 2 ports detected
ACPI: PCI Interrupt 0000:00:1d.7[A] -> GSI 20 (level, low) -> IRQ 193
PCI: Setting latency timer of device 0000:00:1d.7 to 64
ehci_hcd 0000:00:1d.7: EHCI Host Controller
ehci_hcd 0000:00:1d.7: new USB bus registered, assigned bus number 5
ehci_hcd 0000:00:1d.7: debug port 1
PCI: cache line size of 128 is not supported by device 0000:00:1d.7
ehci_hcd 0000:00:1d.7: irq 193, io mem 0xdfeffc00
ehci_hcd 0000:00:1d.7: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb5: configuration #1 chosen from 1 choice
hub 5-0:1.0: USB hub found
hub 5-0:1.0: 8 ports detected
Linux agpgart interface v0.101 © Dave Jones
input: PC Speaker as /class/input/input1
agpgart: Detected an Intel 945G Chipset.
agpgart: Detected 764K stolen memory.
agpgart: AGP aperture is 256M @ 0xe0000000
intel_rng: FWH not detected
parport: PnPBIOS parport detected.
parport0: PC-style at 0x378 (0x778), irq 7, dma 3 [PCSPP,TRISTATE,COMPAT,EPP,ECP,DMA]
Floppy drive(s): fd0 is 1.44M
FDC 0 is a post-1991 82077
Real Time Clock Driver v1.12ac
ACPI: PCI Interrupt 0000:00:1f.3[B] -> GSI 23 (level, low) -> IRQ 209
Adding 1510068k swap on /dev/sda5. Priority:-1 extents:1 across:1510068k
EXT3 FS on sda1, internal journal
loop: loaded (max 8 devices)
skge eth0: enabling interface
ADDRCONF(NETDEV_UP): eth0: link is not ready
skge eth0: Link is up at 100 Mbps, half duplex, flow control none
ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
tun: Universal TUN/TAP device driver, 1.6
tun: © 1999-2004 Max Krasnyansky maxk@qualcomm.com
ACPI: Processor [CPU1] (supports 8 throttling states)
ACPI: Getting cpuindex for acpiid 0x2
ACPI: Getting cpuindex for acpiid 0x3
ACPI: Getting cpuindex for acpiid 0x4
ACPI: Power Button (FF) [PWRF]
ACPI: Power Button (CM) [PWRB]
eth0: no IPv6 routers present
device eth0 entered promiscuous mode
audit(1194887655.499:2): dev=eth0 prom=256 old_prom=0 auid=4294967295
device eth0 left promiscuous mode
audit(1194887660.535:3): dev=eth0 prom=0 old_prom=256 auid=4294967295
device eth0 entered promiscuous mode
audit(1194887666.836:4): dev=eth0 prom=256 old_prom=0 auid=4294967295
device eth0 left promiscuous mode
audit(1194887686.133:5): dev=eth0 prom=0 old_prom=256 auid=4294967295
device eth0 entered promiscuous mode
audit(1194887687.937:6): dev=eth0 prom=256 old_prom=0 auid=4294967295
device eth0 left promiscuous mode
audit(1194887690.429:7): dev=eth0 prom=0 old_prom=256 auid=4294967295
device eth0 entered promiscuous mode
audit(1194887694.421:8): dev=eth0 prom=256 old_prom=0 auid=4294967295
device eth0 left promiscuous mode
audit(1194887696.310:9): dev=eth0 prom=0 old_prom=256 auid=4294967295
device eth0 entered promiscuous mode
audit(1194887705.090:10): dev=eth0 prom=256 old_prom=0 auid=4294967295
device eth0 left promiscuous mode
audit(1194887716.779:11): dev=eth0 prom=0 old_prom=256 auid=4294967295
Mem-info:
DMA per-cpu:
cpu 0 hot: high 0, batch 1 used:0
cpu 0 cold: high 0, batch 1 used:0
DMA32 per-cpu: empty
Normal per-cpu:
cpu 0 hot: high 186, batch 31 used:139
cpu 0 cold: high 62, batch 15 used:2
HighMem per-cpu: empty
Free pages: 247656kB (0kB HighMem)
Active:29077 inactive:20551 dirty:1 writeback:0 unstable:0 free:61914 slab:15626 mapped:1711 pagetables:125
DMA free:9764kB min:88kB low:108kB high:132kB active:0kB inactive:0kB present:16384kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0 494 494
DMA32 free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0 494 494
Normal free:237892kB min:2800kB low:3500kB high:4200kB active:116308kB inactive:82204kB present:506432kB pages_scanned:0 all_unreclaimable? n
o
lowmem_reserve[]: 0 0 0 0
HighMem free:0kB min:128kB low:128kB high:128kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0 0 0
DMA: 3
4kB 3
8kB 2
16kB 3
32kB 4
64kB 1
128kB 2
256kB 1
512kB 01024kB 02048kB 24096kB = 9764kB
DMA32: empty
Normal: 7
4kB 118kB 916kB 632kB 264kB 0128kB 1256kB 1512kB 11024kB 12048kB 574096kB = 237892kB
HighMem: empty
Swap cache: add 0, delete 0, find 0/0, race 0+0
Free swap = 1510068kB
Total swap = 1510068kB
Free swap: 1510068kB
130704 pages of RAM
0 pages of HIGHMEM
2789 reserved pages
48375 pages shared
0 pages swap cached
1 pages dirty
0 pages writeback
1711 pages mapped
15626 pages slab
125 pages pagetables
Mem-info:
DMA per-cpu:
cpu 0 hot: high 0, batch 1 used:0
cpu 0 cold: high 0, batch 1 used:0
DMA32 per-cpu: empty
Normal per-cpu:
cpu 0 hot: high 186, batch 31 used:134
cpu 0 cold: high 62, batch 15 used:2
HighMem per-cpu: empty
Free pages: 247656kB (0kB HighMem)
Active:29080 inactive:20551 dirty:1 writeback:0 unstable:0 free:61914 slab:15626 mapped:1711 pagetables:125
DMA free:9764kB min:88kB low:108kB high:132kB active:0kB inactive:0kB present:16384kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0 494 494
DMA32 free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0 494 494
Normal free:237892kB min:2800kB low:3500kB high:4200kB active:116320kB inactive:82204kB present:506432kB pages_scanned:0 all_unreclaimable? n
o
lowmem_reserve[]: 0 0 0 0
HighMem free:0kB min:128kB low:128kB high:128kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0 0 0
DMA: 34kB 38kB 216kB 332kB 464kB 1128kB 2256kB 1512kB 01024kB 02048kB 24096kB = 9764kB
DMA32: empty
Normal: 7
4kB 118kB 916kB 632kB 264kB 0128kB 1256kB 1512kB 11024kB 12048kB 574096kB = 237892kB
HighMem: empty
Swap cache: add 0, delete 0, find 0/0, race 0+0
Free swap = 1510068kB
Total swap = 1510068kB
Free swap: 1510068kB
130704 pages of RAM
0 pages of HIGHMEM
2789 reserved pages
48378 pages shared
0 pages swap cached
1 pages dirty
0 pages writeback
1711 pages mapped
15626 pages slab
125 pages pagetables

D’abord, tes règles en ACCEPT ne servent pas, puisque tu ne bloque rien par défaut.
par ailleurs, je ne vois pas à quoi sert la règle:
iptables -t nat -A POSTROUTING -o tun0 -p tcp --sport 81 -j SNAT --to 192.168.2.2:81

Bon, mais en oubliant l’initialisation, en supprimant les règles inutiles, et résumant au minimum ce que tu veux faire:

iptables -A POSTROUTING -t nat -o ppp0 -j MASQUERADE iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 81 -j DNAT --to 192.168.2.2:81 echo 1 > /proc/sys/net/ipv4/ip_forwardRien que ça tout seul devrait marcher, à un détail prés dont je ne connais pas l’effet: es tu sur que --to fonctionne, et que tu ne voulais pas plutot mettre --to-destination à la place ?

j’ai testé de mettre avec --to-destination, mais rien n’y fait. Le port est toujours en filtered… :’( De toute facon le script original marche sur les autres serveurs. c’est peut etre au niveau du oyeau, mais je ne connais pas la liste exacte des modules à avoir.

Not shown: 1671 closed ports
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
80/tcp open http
81/tcp filtered hosts2-ns
111/tcp open rpcbind
113/tcp open auth
135/tcp filtered msrpc
445/tcp filtered microsoft-ds
8080/tcp open http-proxy

Nmap finished: 1 IP address (1 host up) scanned in 11.521 seconds

S’ils sont présents, les modules iptables de base sont chargés automatiquement dès qu’une règle les demande, , donc rien à vérifier d’autre que leur présence dans la config de ton noyau. De toutes façons, comme tu n’as rien dit de ce qu’il y avait dans les logs, j’imagine que c’est parceque tu n’y as trouvé aucun message d’erreur ?
A ce propos, as tu executé à la main l’ensemble des commandes, pour vérifier qu’elles passent bien sans erreur et qu’à chaque étape tu obtiens bien ce que tu attendais ?
Sinon, as tu esayé en ne mettant QUE les 3 règles que je t’ai indiqué ?
Et aussi, quel type de flux veux tu faire passer par ton port 81 ? Tu sais qu’il y a des flux qui nécessitent autre chose que l’ouverture d’un port pour le forwarding (le ftp, pptp, sip, h323, etc) ?

Et pour finir, tu pourrais donner le résultat d’iptables-save ?

J’ai bien essayé avec seulement les 3 règles, mais pas de changement.

Je n’ai en effet rien dit pour les logs car aucune erreur n’y apparait.

Il s’agit d’un bête flux http que je veux faire passer, donc à ma connaissance il n’y a aucun autre port à faire forwarder.

Pour ce qui est des commandes une par une, aucune erreur non plus :
srv-plouf:~# iptables -F
srv-plouf:~# iptables -X
srv-plouf:~# iptables -t nat -F
srv-plouf:~# iptables -t nat -X
srv-plouf:~# iptables -A POSTROUTING -t nat -o ppp0 -j MASQUERADE
srv-plouf:~# iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 81 -j DNAT --to 192.168.2.2:81
srv-plouf:~# echo 1 > /proc/sys/net/ipv4/ip_forward

Et bien évidemment, le résultat est le même, le port est en filtered et impossible de se connecter en http sur le port 81 avec ip_exterieure:81

Et pour le iptables-save :
srv-plouf:~# iptables-save

Generated by iptables-save v1.3.6 on Mon Nov 19 22:40:20 2007

*raw
:stuck_out_tongue:REROUTING ACCEPT [1891595:603018181]
:OUTPUT ACCEPT [1246195:211696628]
COMMIT

Completed on Mon Nov 19 22:40:20 2007

Generated by iptables-save v1.3.6 on Mon Nov 19 22:40:20 2007

*nat
:stuck_out_tongue:REROUTING ACCEPT [32032:2905813]
:stuck_out_tongue:OSTROUTING ACCEPT [18458:2929557]
:OUTPUT ACCEPT [471:28046]
-A PREROUTING -i ppp0 -p tcp -m tcp --dport 81 -j DNAT --to-destination 192.168.2.2:81
-A POSTROUTING -o ppp0 -j MASQUERADE
COMMIT

Completed on Mon Nov 19 22:40:20 2007

Generated by iptables-save v1.3.6 on Mon Nov 19 22:40:20 2007

*mangle
:stuck_out_tongue:REROUTING ACCEPT [1891595:603018181]
:INPUT ACCEPT [1336350:320871063]
:FORWARD ACCEPT [555236:282146416]
:OUTPUT ACCEPT [1246197:211696876]
:stuck_out_tongue:OSTROUTING ACCEPT [1801433:493843292]
COMMIT

Completed on Mon Nov 19 22:40:20 2007

Generated by iptables-save v1.3.6 on Mon Nov 19 22:40:20 2007

*filter
:INPUT ACCEPT [1336342:320870679]
:FORWARD ACCEPT [555199:282144464]
:OUTPUT ACCEPT [1246197:211696876]
COMMIT

Completed on Mon Nov 19 22:40:20 2007

Apparemment les règles y apparaissent bien…

Je vais finir par le jeter par la fenêtre ce serveur :slightly_smiling:

Merci

Non, effectivement ça devrait marcher.quote="schnokbul"
Et bien évidemment, le résultat est le même, le port est en filtered et impossible de se connecter en http sur le port 81 avec ip_exterieure:81
(…)[/quote]Depuis ta passerelle elle même ou depuis l’exterieur ?

Tu as essayé de renvoyer autre chose que le 81 vers le 81 de la 2.2, genre renvoyer le 8888 et accèder avec ip_exterieure:8888 ?
Ta machine 2.2 qui sert du web écoute bien sur le port 81, d’ailleurs, tu es sûr ? Que donne un netstat -tupl sur la 2.2 ?

Sinon, question con: y a t il un pare feu sur la 2.2 ?

Re-Bonjour,

le port est en filtered depuis l’extérieur, si je fait nmap depuis l’extérieur (un serveur chez ovh en l’occurence) j’ai :
archimede:~# nmap ip_exterieure
Starting Nmap 4.11 ( insecure.org/nmap/ ) at 2007-11-20 10:51 CET
Interesting ports on ip_exterieure (machin.truc.bidule.chose):
Not shown: 1670 closed ports
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
80/tcp open http
81/tcp filtered hosts2-ns
111/tcp open rpcbind
113/tcp open auth
135/tcp filtered msrpc
445/tcp filtered microsoft-ds
6667/tcp filtered irc
8080/tcp open http-proxy
Nmap finished: 1 IP address (1 host up) scanned in 5.349 seconds

et si je fait un nmap sur la machine srv-plouf sur l’adresse extérieure de cette meme machine cela donne :
srv-plouf:~# nmap ip_exterieure

Starting Nmap 4.11 ( insecure.org/nmap/ ) at 2007-11-20 12:54 CET
Interesting ports on ipexterieure (machin.truc.bidule.chose):
Not shown: 1674 closed ports
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
113/tcp open auth
8080/tcp open http-proxy
Nmap finished: 1 IP address (1 host up) scanned in 0.209 seconds

Chose qui d’ailleurs me semble déjà un poil bizarre car dans la secodne commande, le port 81 n’est meme pas mentionné.
J’ai déjà tenté de rediriger le flux sur d’autres ports et d’autres ip, mais le réusultat est toujours le même. Impossible de consulter la page et le port est filtered.

Bien évidement il n’y a pas de fw sur la machine en .2.2 :wink:

pour le netstat:
srv-plouf:~# netstat -tupl 192.168.2.2
Connexions Internet actives (seulement serveurs)
Proto Recv-Q Send-Q Adresse locale Adresse distante Etat PID/Program name
tcp 0 0 *:48651 : LISTEN 4585/rpc.statd
tcp 0 0 *:sunrpc : LISTEN 2060/portmap
tcp 0 0 *:webcache : LISTEN 2322/openvpn
tcp 0 0 *:auth : LISTEN 4550/inetd
tcp 0 0 localhost:smtp : LISTEN 2446/exim4
tcp6 0 0 *:www : LISTEN 4648/apache2
tcp6 0 0 *:ftp : LISTEN 4608/proftpd: (acce
tcp6 0 0 *:ssh : LISTEN 4560/sshd
udp 0 0 *:32772 : 4585/rpc.statd
udp 0 0 *:945 : 4585/rpc.statd
udp 0 0 *:bootps : 4596/dhcpd3
udp 0 0 *:sunrpc : 2060/portmap

Mais je précise que j’ai fait le netstat sur le serveur avec l’ip extérieure, car la machine en .2.2 est un IIS en windows.

[quote=“schnokbul”]Re-Bonjour,[/quote]Yo.quote="schnokbul"
Chose qui d’ailleurs me semble déjà un poil bizarre car dans la secodne commande, le port 81 n’est meme pas mentionné.[/quote]Non, c’est normal: ton nmap ne rentre pas par ppp0, mais par lo, donc la redirection ne s’applique pas. Pour tester, il faudrait ajouter la ligne de redirection pour lo aussi. [quote=“schnokbul”]J’ai déjà tenté de rediriger le flux sur d’autres ports et d’autres ip, mais le réusultat est toujours le même. Impossible de consulter la page et le port est filtered.[/quote][quote=“schnokbul”]

Bien évidement il n’y a pas de fw sur la machine en .2.2 :wink:

pour le netstat:
srv-plouf:~# netstat -tupl 192.168.2.2
Connexions Internet actives (seulement serveurs)
Proto Recv-Q Send-Q Adresse locale Adresse distante Etat PID/Program name
tcp 0 0 *:48651 : LISTEN 4585/rpc.statd
tcp 0 0 *:sunrpc : LISTEN 2060/portmap
tcp 0 0 *:webcache : LISTEN 2322/openvpn
tcp 0 0 *:auth : LISTEN 4550/inetd
tcp 0 0 localhost:smtp : LISTEN 2446/exim4
tcp6 0 0 *:www : LISTEN 4648/apache2
tcp6 0 0 *:ftp : LISTEN 4608/proftpd: (acce
tcp6 0 0 *:ssh : LISTEN 4560/sshd
udp 0 0 *:32772 : 4585/rpc.statd
udp 0 0 *:945 : 4585/rpc.statd
udp 0 0 *:bootps : 4596/dhcpd3
udp 0 0 *:sunrpc : 2060/portmap

Mais je précise que j’ai fait le netstat sur le serveur avec l’ip extérieure, car la machine en .2.2 est un IIS en windows.[/quote]Ben voilà !
Voyons, c’est normal que tu ne trouves rien sur le port 81, puisque ton IIS écoute sur le port 80.
Remplaces par ça:
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 81 -j DNAT --to 192.168.2.2:80
J’ai gardé le 81 au niveau de ta passerelle, mais je te conseille quand même de choisir un port qui n’est pas attribué, même si ça marche comme ça.
Sinon, si ça ne marche encore pas pas, quand tu dis que tu n’as pas de pare feu sur la machine windaube, tu sous entends que tu as bien arrèté cette merde infame de service de pare feu vingt doses ?

Non le problème ne viens pas de là car j’ai bien configuré IIS pour qu’il écoute aussi sur le port 81, et quand je testes avec une machine du réseau, le 192.168.2.2:81 répond et la page s’affiche sans soucis.

le netstat a été fait sur le serveur debian qui fait office de frontal.

Et puis la machine windows est un Windows 2000 server donc de toute facon il n’y a pas de firewall dessus :slightly_smiling: sur ce point il n’y a pas de doute, car même si je fait le port forward vers une autre machine soit sur le port 80 ou 81 de cette autre machine, depuis l’extérieur, c’est toujours filtered.

Ah OK.
Alors je manque d’idée. Tout a l’air bon.
C’est forcément un truc trés con…

Et de l’exterieur, indépendament de ce que dit nmap, avec un browser, ça ne passe pas ?

Non malheureusement :’(

J’avoue que même après 10 ans de linux, là j’ai séché méchamment…

Au feeling, avec une connection ppp, essayes ça, à tous hasards:

iptables -A FORWARD -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j TCPMSS --clamp-mss-to-pmtu iptables -t mangle -A FORWARD -o ppp0 -p tcp -m tcp --tcp-flags SYN,RST SYN -m tcpmss --mss 1400:1536 -j TCPMSS --clamp-mss-to-pmtu J’ai repris ça sur une machine qui a beaucoup vécu, donc les deux lignes sont peut être redondantes.

A insèrer bien sur avant la règle ACCEPT :wink:

Rien à faire, toujours “filtered”.

La réinstallation de la passerelle semble être l’ultime solution alors ? :confused:

Je ne vois pas ce que ça va changer. Par contre, peut être qu’un autre noyau…

Ben en fait ce problème est apparu suite à la réinstallation du serveur, car le précédent a crashé. J’ai refait comme à mon habitude toutes les manips que j’avais faites lors de la première install et qui marchaient. Car jusqu’a ce crash, le port forward marchais très bien. Et le problème est apparu…

Je vais réinstaller, et on verra bien, je vous tiendrais au courant.

Merci quand même de votre aide :slightly_smiling: