blackest_knight
May 9th, 2009, 09:28 PM
This is a rather complicated set up so bare with me.
I've got a hspda modem this is connected to a server/desktop
and the eth0 is connected to the wan port of a router.
for those interested to portforward you need to
edit
/etc/sysctl.conf
and un comment this line
net.ipv4.ip_forward=1
this script below would set up ipables for forwarding if run by root.
and would be reset on a reboot (probably)
#bin/bash
ifconfig eth0 192.168.2.1
iptables -t nat -A POSTROUTING -o ppp0 -s 192.168.2.0/24 -j MASQUERADE
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 3074 -j DNAT --to-destination 192.168.2.254
iptables -t nat -A PREROUTING -i ppp0 -p udp --dport 88 -j DNAT --to-destination 192.168.2.254
iptables -t nat -A PREROUTING -i ppp0 -p udp --dport 3074 -j DNAT --to-destination 192.168.2.254
iptables -t nat -A PREROUTING -i ppp0 -p udp -m multiport --dports 88,3074 -j DNAT --to-destination 192.168.2.254
iptables -A FORWARD -i ppp0 -d 192.168.2.254 -p tcp --dport 3074 -j ACCEPT
iptables -A FORWARD -i ppp0 -d 192.168.2.254 -p udp -m multiport --dports 88,3074 -j ACCEPT
The router wan port is set as static 192.168.2.254 and gateway 192.168.2.1
on the lan side the router sits as 192.168.3.1 and gives out addresses with its dhcp server as 192.168.3.x
printing was solved by connecting to 192.168.3.1:631 and turning on ipp (internet printing protocol)
now for my real problem which is nfs sharing I have most of my media on the pc which is sharing the internet connection to the rest of the lan via my router.
so what I want to be able to do is mount a share eg 192.168.2.1/media/mymedia
and mount it at 192.168.3.x/media/myshare
unfortunately i'm rather stuck at this point.
anyone know how to do this?
it's really the reverse of the usual situation where you want to access a share behind a nat'ed router (in which case you just set up port forwarding in the router)
I've got a hspda modem this is connected to a server/desktop
and the eth0 is connected to the wan port of a router.
for those interested to portforward you need to
edit
/etc/sysctl.conf
and un comment this line
net.ipv4.ip_forward=1
this script below would set up ipables for forwarding if run by root.
and would be reset on a reboot (probably)
#bin/bash
ifconfig eth0 192.168.2.1
iptables -t nat -A POSTROUTING -o ppp0 -s 192.168.2.0/24 -j MASQUERADE
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 3074 -j DNAT --to-destination 192.168.2.254
iptables -t nat -A PREROUTING -i ppp0 -p udp --dport 88 -j DNAT --to-destination 192.168.2.254
iptables -t nat -A PREROUTING -i ppp0 -p udp --dport 3074 -j DNAT --to-destination 192.168.2.254
iptables -t nat -A PREROUTING -i ppp0 -p udp -m multiport --dports 88,3074 -j DNAT --to-destination 192.168.2.254
iptables -A FORWARD -i ppp0 -d 192.168.2.254 -p tcp --dport 3074 -j ACCEPT
iptables -A FORWARD -i ppp0 -d 192.168.2.254 -p udp -m multiport --dports 88,3074 -j ACCEPT
The router wan port is set as static 192.168.2.254 and gateway 192.168.2.1
on the lan side the router sits as 192.168.3.1 and gives out addresses with its dhcp server as 192.168.3.x
printing was solved by connecting to 192.168.3.1:631 and turning on ipp (internet printing protocol)
now for my real problem which is nfs sharing I have most of my media on the pc which is sharing the internet connection to the rest of the lan via my router.
so what I want to be able to do is mount a share eg 192.168.2.1/media/mymedia
and mount it at 192.168.3.x/media/myshare
unfortunately i'm rather stuck at this point.
anyone know how to do this?
it's really the reverse of the usual situation where you want to access a share behind a nat'ed router (in which case you just set up port forwarding in the router)