iptables trouble: nat with ip alias (virtual interface) not working
69
When you use virtual interfaces just use the option -d (destination), ignoring the option -i (interface)
Instead of:
iptables -t nat -A PREROUTING -i eth0 -d 25.25.25.26 -j DNAT --to-destination 172.16.2.1
use:
iptables -t nat -A PREROUTING -d 25.25.25.26 -j DNAT --to-destination
Work with iptables v1.4.14 in Debian
Author by
satya
Updated on September 18, 2022Comments
-
satya over 1 year
I am calculating the day difference between two day using JavaScript. For some cases I am getting right result but some cases I cannot get the right result. My code is below:
function caldate(){ var difference=Math.abs((parseInt(document.getElementById('dayto').value)%7)-(parseInt(document.getElementById('dayfrom').value)%7))+1; alert(difference); }
Here when
day to
is Sunday I am getting the wrong result. My plunkr code is here. I need to calculate the difference between two day including both selected days.-
adeneo over 7 yearsWhy are you changing the values with
.abs()
and%7
, just compare the values -
satya over 7 years@adeneo : suppose i selected
from day=wedensday
andto day=sunday
the difference should5
. -
charlietfl over 7 yearsit is 5 if you remove
%7
-
adeneo over 7 yearsThe values are numeric strings, just subtract them, as in
value1 - value2
, and if you want to avoid negative numbers wrap the whole thing in aMath.abs
call -
Emil S. Jørgensen over 7 yearsQuestion: If
dayfrom
is greater thandayto
, are we to assume another that day, but in next week?
-
-
Larssend about 7 yearsThe
FORWARD
chain is not part of thenat
table. Your proposed 'correction' will not be accepted byiptables
-- it will give you an error message instead. -
Larssend about 7 yearsAlso, DNAT is only valid for
PREROUTING
andOUTPUT
chains. Please avoid recommending anything that you don't really know.