# bash -x ./router.sh
+ ip route add default via 192.168.6.1 table link1
RTNETLINK answers: File exists
+ ip route add default via 192.168.5.1 table link2
RTNETLINK answers: No such process
+ ip rule add fwmark 1 table link1
+ ip rule add fwmark 2 table link2
+ iptables -t mangle -A PREROUTING -j MARK --set-mark 1
+ iptables -t mangle -A PREROUTING -m state --state new -j MARK --set-mark 2
+ iptables -t mangle -A PREROUTING -m state --state new -m statistic --mode random --probability 0,5 -j MARK --set-mark 1
+ iptables -t nat -A POSTROUTING -o -j SNAT --to
Bad argument `SNAT'
Try `iptables -h' or 'iptables --help' for more information.
+ iptables -t nat -A POSTROUTING -o -j SNAT --to
Bad argument `SNAT'
Try `iptables -h' or 'iptables --help' for more information.
+ echo 'Script carregado com sucesso...'
Script carregado com sucesso...
Em 16 de outubro de 2012 17:03, Gabriel Ricardo
<gricardo87@gmail.com> escreveu:
execute o script com bash -x para saber onde extamente está ocorrendo o erro.
Gabriel Ricardo.
Em 16 de outubro de 2012 16:56, Márcio Erli
<marcioerli@gmail.com> escreveu:
Sempre que executo o script a baixo, me retorna o seguinte erro.
Bad argument `SNAT'
Try `iptables -h' or `iptables --help' for more information
#!/bin/bash
ip route add default via 200.235.xx.xx table link1
ip route add default via 200.195.xx.xx table link2ip rule add fwmark 1 table link1
ip rule add fwmark 2 table link2
iptables -t mangle -A PREROUTING -j MARK --set-mark 1
iptables -t mangle -A PREROUTING -m state --state new -j MARK --set-mark 2
iptables -t mangle -A PREROUTING -m state --state new -m statistic --mode random --probability 0,5 -j MARK --set-mark 1
iptables -t nat -A POSTROUTING -o $LINK1_WAN_INTERFACE -j SNAT --to $LINK1_WAN_IP
iptables -t nat -A POSTROUTING -o $LINK2_WAN_INTERFACE -j SNAT --to $LINK2_WAN_IPEm 16 de outubro de 2012 10:10, paulo bruck
<paulobruck1@gmail.com> escreveu:
Bom dia
Em 16 de outubro de 2012 09:45, Márcio Erli
<marcioerli@gmail.com> escreveu:
Quando executo o comando a baixo da o seguinte erro: bad argument `snat`. Alguém sabe como resolver isso?
# iptables -t nat -A POSTROUTING -o $LINK1_WAN_INTERFACE -j SNAT –to $LINK1_WAN_IP
humm não seria
iptables -t nat -A POSTROUTING -o $LINK1_WAN_INTERFACE -j SNAT --to $LINK1_WAN_IP
( - - to : com dois sinais de "-" ???)
verifique tambem se existem as variaveis LINK1_WAN_INTERFACE e
Basta fazer um echo antes assim:
echo $LINK1_WAN_INTERFACE
echo $LINK1_WAN_IP
ats