Azure Linux VM : Internet access via 2nd NIC
hi,
I attached a 2nd NIC to my Linux VM, on the same subnet. Internal IP's of both NIC's are following:
eth0 : 10.0.1.4
eth1 : 10.0.1.5
Both NIC's have public IP's assigned. Problem is that we can't ping any public server (e.g. bing.com) via eth1. Internet is accessible via eth0 only.
We have tried adding default route via following command, but it didn't help:
route add -net 0.0.0.0 netmask 0.0.0.0 gw 10.0.1.1 dev eth1
Please advise how to configure 2nd NIC to have Internet access via eth1.
Azure Virtual Network
-
Andriy Bilous • 11,821 Reputation points • MVP • Volunteer Moderator
2023-07-06T14:28:29.1966667+00:00 Hello @Omar
When you add multiple network interfaces to a Linux VM, you have to create routing rules. These rules enable the VM to send and receive traffic that belongs to a specific network interface. Otherwise, traffic can't be processed correctly. For example, traffic that belongs to eth1 can't be processed correctly by the defined default route.
The following document provides the required configuration for two network interfaces to work in Linux VMs that run the most common Linux distributions.
-
KapilAnanth-MSFT • 49,611 Reputation points • Microsoft Employee • Moderator
2023-07-10T08:14:32.96+00:00 Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.
I understand that you would like to access internet from your secondary NIC in an Azure Linux VM.
I just want to clarify one thing,
- Are you trying to access Internet from the VM via NIC2 (eth1)
- or
- Are you trying to access your VM via NIC2(eth1) from the Internet?
I see Andriy Bilous has mentioned the requirements for getting the secondary NIC operational.
- Can you confirm if the steps mentioned in https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/linux-vm-multiple-virtual-network-interfaces-configuration?tabs=1subnet%2Cubuntu are done?
- If so, are you able to ping to/from the secondary NIC to other VMs in the same Vnet?
Cheers,
Kapil
-
KapilAnanth-MSFT • 49,611 Reputation points • Microsoft Employee • Moderator
2023-07-11T05:43:52.83+00:00 Can you please update us if the action plan provided was helpful?
Should there be any follow-up questions or concerns, please let us know and we shall try to address them.
Thanks,
Kapil
-
KapilAnanth-MSFT • 49,611 Reputation points • Microsoft Employee • Moderator
2023-07-12T05:31:01.3766667+00:00 Can you please update us if the action plan provided was helpful?
May I know if you got a chance to review my previous comment?
Please let me know if you are facing any challenges or if there are any follow-up questions, I shall be glad to address them.
Thanks,
Kapil
-
Deleted
This comment has been deleted due to a violation of our Code of Conduct. The comment was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
-
KapilAnanth-MSFT • 49,611 Reputation points • Microsoft Employee • Moderator
2023-07-13T12:21:14.5966667+00:00 Reaching out to check if there are any questions on this.
Please let us know if we can be of any further assistance here.
Thanks,
Kapil
-
Omar • 0 Reputation points
2023-07-13T12:49:15.09+00:00 hi Kapil,
Apologies for the delay. We have evaluated the article however haven't tried the steps yet.
However, at the end of article the acceptance test mentioned reveals that connectivity to that VM with 2 NIC's is being checked from another VM on the same subnet/VNET.
We are seeing the problem in other other direction. The machine may not be reachable via both NIC from internal network. However the applications on the VM must be able to reach public Internet via both NIC's. so something like following should work:
ping bing.com -i eth0 ping bong.com -i eth1
If you think that suggested article would result in the desirable behavior, we can give it a try.
-
KapilAnanth-MSFT • 49,611 Reputation points • Microsoft Employee • Moderator
2023-07-17T11:02:38.2866667+00:00 Wrt, "the applications on the VM must be able to reach public Internet via both NIC's."
- Yes, this is feasible
- And the documentation mentions the exact steps to achieve this.
Please give it a try and you should be able to access internet resources via both the NICs
Cheers,
Kapil
-
KapilAnanth-MSFT • 49,611 Reputation points • Microsoft Employee • Moderator
2023-07-18T05:38:06.39+00:00 May I know if you got a chance to review my previous comment?
Please let me know if you are facing any challenges or if there are any follow-up questions, I shall be glad to address them.
Thanks,
Kapil
-
Omar • 0 Reputation points
2023-07-25T13:10:14.5133333+00:00 I have made the configurations changes as per article, but netplan is giving some error when I tried to apply the changes. Looking into this.
-
Omar • 0 Reputation points
2023-07-25T13:11:05.1266667+00:00 by the way, why it so complicated. When a NIC can be added to VM via Azure Portal quite easily, why such configurations can't be done automatically?
-
KapilAnanth-MSFT • 49,611 Reputation points • Microsoft Employee • Moderator
2023-07-26T07:06:37.0733333+00:00 @Omar Can you please provide the screenshot of the error message.
Azure VMs are IaaS offerings, which means we have little control over the OS.
Also, the Linux OS's are marketplace images.
The requirement to make these configurations come from the OS, not the platform.
The process would have been different and straight forward with Windows machines : https://learn.microsoft.com/en-us/azure/virtual-machines/windows/multiple-nics#configure-guest-os-for-multiple-nics
Cheers,
Kapil
-
KapilAnanth-MSFT • 49,611 Reputation points • Microsoft Employee • Moderator
2023-08-01T12:50:35.1233333+00:00 -
Omar • 0 Reputation points
2023-08-01T13:02:03.3566667+00:00 here is the log for the last step, which fails:
$ sudo netplan apply bind: Address already in use netplan: fatal error: cannot bind to port 2983, is another daemon running?, exiting.
I have checked from netstat and port number 2983 is not in use. I couldn't find any apparent reason for the error.
-
Omar • 0 Reputation points
2023-08-01T13:03:34.9+00:00 here is the log for the last step, which fails:
$ sudo netplan apply bind: Address already in use netplan: fatal error: cannot bind to port 2983, is another daemon running?, exiting.
I have checked from netstat and port number 2983 is not in use. I couldn't find any apparent reason for the error.
-
KapilAnanth-MSFT • 49,611 Reputation points • Microsoft Employee • Moderator
2023-08-03T06:22:29.1+00:00 To troubleshoot the exact issue, I think we will need a specialized 1:1 session, where a support engineer can have a screen share session to pinpoint the issue. If you have a support plan you may file a support ticket, else please do let us know, we will try and help you get a one-time free technical support.
In case you need a one-time free technical support could you please send an email to
AzCommunity[At]Microsoft[Dot]Com with the below details.
- Subject : Attn Kaananth
- Thread URL: Link to this thread.
- Subscription ID : Subscription ID where this VM is deployed
Cheers,
Kapil
Sign in to comment