We can mark packets on the basis of IP addresses in the following way -
iptables -A FORWARD -t mangle -s 18.104.22.168 -j MARK --set-mark 1
How to mark packets depending on the hostname? I tried this -
iptables -A FORWARD -t mangle -s google.co.in -j MARK --set-mark 1
iptables utitlity gets the IP address of
google.co.in from the DNS and adds the entry to the mangle table. How to mark all the packets from
google.co.in, and not just from the single server of Google. As there are thousands of servers, manually adding all IP addresses is also not possible.
Is there any way to read the packet and get the hostname and mark it?