Skip to contentSkip to conversation

Network filtering setup

DISCUSSION Jacob Gorm Hansen 2 participants 2 messages Dec 22, 2006 – Dec 23, 2006

lore
Share & tools
lore
#0 lore raw

hi,

back in Xen 1.x days I had this wonderful setup where I did not have to bother with vifs and bridges or fake MAC addresses, and the following piece of C in dom0:

void setup_vfr_rules_for_vif(int dom,int vif,char* guest_ip)

{
    int f = open("/proc/xen/vfr",O_WRONLY);
    char s[256];
    sprintf(s,"ADD ACCEPT dstaddr=%s dstaddrmask=255.255.255.255 src=ANY
dstdom=%d dstidx=%d proto=any\n", guest_ip,dom,0 );
    write(f,s,strlen(s));
    sprintf(s,"ADD ACCEPT srcaddr=%s srcaddrmask=255.255.255.255 srcdom=
%d srcidx=%d dst=PHYS proto=any\n",guest_ip,dom,0 );
    write(f,s,strlen(s));
    close(f);
}

Would allow a domU to send and receive IP traffic through eth0, including somehow magically getting ARP request answered our routed to the right place.

I have been trying various things to get the same effect in Xen 3.x, but to be honest my iptables knowledge is a bit rusty, so all I have been able to come up with is a routed setup, but that only seems to work when all the peers have the host hardcoded into their routing tables.

Does anyone have the perfect setup (list of iptables commands I suppose) for this, preferable without bridging at the Ethernet layer? NAT/Masquerading is not an option, as I prefer not to have any state kept in dom0.

Thanks,
Jacob

#1 lore raw
Quoted 4 lines · Jacob Gorm Hansen

Does anyone have the perfect setup (list of iptables commands I suppose) for this, preferable without bridging at the Ethernet layer? NAT/Masquerading is not an option, as I prefer not to have any state kept in dom0.

What you're asking for is different to what was done in Xen 1.x which, as I recall, did Ethernel-level bridging with IP-level firewalling. The closest match in Xen 3.x would be etherbridge + etherbridge hooks into ip tables.

-- Keir