Find the answer to your Linux question:
Results 1 to 4 of 4
hello I need to configure 2 subnets: eth0 - my ISP DSL cable - real_IP eth1 - my first subnet - 192.168.0.0/24 - ONLY FTP access should be allowed FROM ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2007
    Posts
    2

    sharing Internet on 3 subnets


    hello

    I need to configure 2 subnets:
    eth0 - my ISP DSL cable - real_IP
    eth1 - my first subnet - 192.168.0.0/24 - ONLY FTP access should be allowed FROM it
    eth2 - my second subnet - 192.168.1.0/24 - everything is allowed, and it also host an HTTP server

    I come with that after reading some tutorials and seeing some samples... can someone tell me if this seems correct?
    also, do I need to use the "route" command or iptables will take care of the routing alone?

    #inclusive firewall
    $IPTABLES -P INPUT DROP
    $IPTABLES -P OUTPUT DROP
    $IPTABLES -P FORWARD DROP

    #probably needed to use states since eth1 will use FTP
    $IPTABLES -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
    $IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
    $IPTABLES -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

    #eth1 rules
    $IPTABLES -A FORWARD -i eth0 -d 192.168.0.0/24 -p tcp --dport 21 -j ACCEPT

    #eth2 rules
    $IPTABLES -A FORWARD -i eth0 -d 192.168.1.0/24 -j ACCEPT
    $IPTABLES -A FORWARD -s 192.168.1.0/24 -o eth0 -j ACCEPT
    $IPTABLES -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.0

    thanks very much

    PS: this is just a router computer... it doesn't need to access anything

  2. #2
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,672
    Have you turned on forwarding? It is off by default.

    As root
    Code:
    /bin/echo 1 >/proc/sys/net/ipv4/ip_forward

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  3. #3
    Just Joined!
    Join Date
    Oct 2007
    Posts
    2
    Quote Originally Posted by Lazydog View Post
    Have you turned on forwarding? It is off by default.

    As root
    Code:
    /bin/echo 1 >/proc/sys/net/ipv4/ip_forward
    yep
    but I figured that was the problem

    thanks very much

  4. #4
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,672

    Thumbs up

    You are welcome.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •