Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    MAC Address on Connection Sharing

    My computer have 2 NICs and I want to share Internet from eth0 to eth1 like that

    Internet <<==>> Router1 <<=>> eth0 <> Ubuntu gateway(My PC)* <> eth1 <<==>> Wifi Router <==> PC1,PC2,...

    I think I will config like this page. But I don't know if Router1 can see MAC of eth1 and PC1, PC2,... or it can only see MAC of eth0. Because I want to hide MAC of all device.
    I use Ubuntu 12.04
    Someone can help me how to config to hide all MAC address of my device Sorry because my English not good

  2. #2
    Just Joined! rajagenupula's Avatar
    Join Date
    Nov 2013
    If you fine with changing to some other MAC address then I can help you with this command
    ifconfig eth0 hw ether 00:80:48:BA:d1:30
    There 00:80:48:BA:d1:30 is some other duplicate MAC. indirectly it can be consider as hiding original MAC.

  3. #3
    You could add a NAT masqrading rule using iptables. this way the clients behind eth1 will use the IP and source mac of eth0 when leaving the eth0 interface.

    However, this requires that you have a separate subnet on eth1, so that the ubuntu box can route packets correctly.

    # Flush ip tables, just to remove conflicts. (very optional)
    iptables --flush
    iptables --table nat --flush
    iptables --delete-chain
    iptables --table nat --delete-chain

    # Create a table rule for masqurading routed packets leaving eth0
    iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE

    # Forward packets entering at eth1
    iptables --append FORWARD --in-interface eth1 -j ACCEPT

    # Enable ipv4 forwarding
    echo 1 > /proc/sys/net/ipv4/ip_forward

    PS: You need to setup your clients to use the ubuntu box eth1 ip address as the default gateway.

    Was this what you are looking for? or do you want them all to be in the same subnet?

  4. $spacer_open
  5. #4
    Just Joined! rajagenupula's Avatar
    Join Date
    Nov 2013
    If I am not wrong I think he is just looking for hiding MAC

    Sent from my ST26i using Tapatalk

  6. #5
    Then i would rather use ebtables to post-proccess the mac addresses. simular to NAt but on Layer 2
    Requirements: bridge-utils and ebtables.
    apt-get install bridge-utils ebtables
    Set up a bridge:
    brctl addbr br0
    brctl addif br0 eth0
    brctl addif br0 eth1
    If network is using DHCP
    dhclient3 br0

    ebtables -t nat -A POSTROUTING -o eth0 -j snat --to-src MACADDRESS-TO-FAKE --snat-arp --snat-target ACCEPT
    For each client behind eth1
    ebtables -t nat -A PREROUTING -p IPv4 -i eth0 --ip-dst IP-ADDRESS-HERE -j dnat --to-dst REAL-MAC-HERE --dnat-target ACCEPT
    ebtables -t nat -A PREROUTING -p ARP -i eth0 --arp-ip-dst IP-ADDRESS-HERE -j dnat --to-dst REAL-MAC-HERE --dnat-target ACCEPT

    All commands done as root.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts