using the arduino yun as router

the arduino yun is connected to a router via wifi
and to a computer via ethernet.

i'm trying to do a ping from the computer to the router.
how can i configure the arduino yun to operate as a router and to forward the ip from the ethernet subnet to the wifi subnet

thank you

You can use UCI to configure Linino.
With UCI I think it is possible to do what you want, it is something like this

thank you
my goal is to move packets that arrive from 192.168.6.0/24 network to the gateway 192.168.1.162 (it's the wifi that's connected to the network router - it's ip is 192.168.1.253)

i write the command: ip route add 192.168.6.0/24 via 192.168.1.162 dev wlan0
and get this message: RTNETLINK answers: File exists
i get ping from a computer in the 192.168.6.0/24 to the wifi 192.168.1.162 but not to the router 192.168.1.253

the route command looks like this:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.1     0.0.0.0         UG    0      0        0 wlan0
192.168.1.0     192.168.1.162   255.255.255.0   UG    0      0        0 wlan0
192.168.1.0     *               255.255.255.0   U     0      0        0 wlan0
192.168.5.0     *               255.255.255.0   U     0      0        0 eth0
192.168.6.0     *               255.255.255.0   U     0      0        0 eth1

Forwarding packets is not achieved with the routing table but with a firewall. Try this Firewall configuration [Old OpenWrt Wiki] : it has a Forwardings paragraph. Also, don't forget to install the requirements

i'm not interested in port forwarding
but ip forwarding. when i get data from the network connected to eth1 with the dest ip of the network connected to wlan0, i want the yun to act as a router and forward the data to the right network

inno3D:
i'm not interested in port forwarding
but ip forwarding. when i get data from the network connected to eth1 with the dest ip of the network connected to wlan0, i want the yun to act as a router and forward the data to the right network

That's what the guide I linked is about

my /etc/config/firewall file looks like this now:

config defaults
        option syn_flood        1
        option input            ACCEPT
        option output           ACCEPT
        option forward          REJECT

config zone
        option name             lan
        option network          'wlan0'
        option input            ACCEPT
        option output           ACCEPT
        option forward          REJECT

config zone
        option name             wan
        option network          'eth1'
        option input            ACCEPT
        option output           ACCEPT
        option forward          REJECT

config forwarding
        option src              wan
        option dest             lan

and i still get an error with ping: destination port unreachable

I'm not a network expert but I see two possible mistakes.
First, both your zones have option forward REJECT which suggests forward won't work despite of the configuration.
Second, by quoting the docs

To allow bidirectional traffic flows between two zones, two forwardings are required, with src and dest reversed in each.

Since ping relies in receiving back an ACK packet, you may want to add the reverse forward rule

I did the job with these sysctl.conf and firewall settings.

root@myName:/etc/sysctl.conf

kernel.panic=3
net.ipv4.conf.default.arp_ignore=1
net.ipv4.conf.all.arp_ignore=1
net.ipv4.ip_forward=1
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.icmp_ignore_bogus_error_responses=1
net.ipv4.tcp_ecn=0
net.ipv4.tcp_fin_timeout=30
net.ipv4.tcp_keepalive_time=120
net.ipv4.tcp_syncookies=1
net.ipv4.tcp_timestamps=1
net.ipv4.tcp_sack=1
net.ipv4.tcp_dsack=1

net.ipv6.conf.default.forwarding=1
net.ipv6.conf.all.forwarding=1

net.netfilter.nf_conntrack_acct=1
net.netfilter.nf_conntrack_checksum=0
net.netfilter.nf_conntrack_max=16384
net.netfilter.nf_conntrack_tcp_timeout_established=3600
net.netfilter.nf_conntrack_udp_timeout=60
net.netfilter.nf_conntrack_udp_timeout_stream=180

root@myName:/etc/config/firewall

config defaults
       option syn_flood '1'
       option input 'ACCEPT'
       option output 'ACCEPT'
       option forward 'REJECT'

config zone
       option name 'lan'
       option network 'lan'
       option input 'ACCEPT'
       option output 'ACCEPT'
       option forward 'ACCEPT'
       option masq '1'

config zone
       option name 'wan'
       option network 'wan'
       option input 'ACCEPT'
       option output 'ACCEPT'
       option forward 'ACCEPT'
       option masq '1'

Note:

  1. the ipforward in sysctl.conf enable the forwarding inside the yun
  2. If you need go outside your network to the intenet from the arduino lan you need masq the package to your adsl router for natting
  3. I f you want see from clients of your home lan the arduino yun lan clients you need staticly route the arduino yun lan subnet to the arduino yun IP of the wan card on the default gateway of your home lan
  4. For pinging remember to open the ICMP protocol

Hope this usefull

Zep