title: Name resolution for dummy interfaces
body: <p>I've a virtual NIC of type NAT on my Ubuntu 20.04 virtual machine which connects it to the internet via host. For some processing, I need to route all incoming and outgoing packets via a program I've to write. For example, assume that I've to drop some packets and don't let them go out of the VM.</p>
  <p>For this, I created a dummy interface with the following:</p>
  <pre><code>modprobe dummy
  ip link add tun0 type dummy
  ifconfig tun0 up
  </code></pre>
  <p>For all traffics not to go directly through the NIC, I added:</p>
  <pre><code>ip route add default dev tun0
  </code></pre>
  <p>Now everything is ok. For example when I</p>
  <pre><code>ping 4.2.2.4
  </code></pre>
  <p>, I see that the ping is not answered when my program is not running and is answered properly when it's running. The program works like a bridge between enp0s3 and tun0 for now. The whole traffic is routing through my program. Just a problem exists, name resolution. That's when I</p>
  <pre><code>ping google.com
  </code></pre>
  <p>, the name can't be resolved. The route table now is as follows:</p>
  <pre><code>Kernel IP routing table
  Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
  0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 tun0
  0.0.0.0         10.0.2.2        0.0.0.0         UG    20100  0        0 enp0s3
  10.0.2.0        0.0.0.0         255.255.255.0   U     100    0        0 enp0s3
  169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 enp0s3
  </code></pre>
  <p>Of couse if I</p>
  <pre><code>sudo route del default
  </code></pre>
  <p>, the name resolution takes place via the NAT adapter through the host properly. Please let me know what's wrong with the name resolution in this situation.</p>