Packet traversal in the Linux networking stack
I am trying to understand the packet traversal in Linux. I found a diagram from link.
My linux box has the following routing table:
default via 192.168.2.1 dev wlan0 proto static metric 1024
169.254.0.0/16 dev wlan0 scope link metric 1000
192.168.2.0/24 dev wlan0 proto kernel scope link src 192.168.2.73
If I send a ping to 8.8.8.8:
- It would first pass OUTPUT table rules
- The routing decision will check routing table and use the default route which states using the device wlan0
- It will pass POSTROUTING rules and will be send out on wlan0
For the ping response, assuming it arrives on wlan0, it would first pass the PREROUTING rules. My question is that at this point, what will it gain by checking the routing table because the diagram suggest a routing decision is made; or is it just to check if a packet does not have IP associated with any of the interfaces on the machine ?
networking netfilter
add a comment |
I am trying to understand the packet traversal in Linux. I found a diagram from link.
My linux box has the following routing table:
default via 192.168.2.1 dev wlan0 proto static metric 1024
169.254.0.0/16 dev wlan0 scope link metric 1000
192.168.2.0/24 dev wlan0 proto kernel scope link src 192.168.2.73
If I send a ping to 8.8.8.8:
- It would first pass OUTPUT table rules
- The routing decision will check routing table and use the default route which states using the device wlan0
- It will pass POSTROUTING rules and will be send out on wlan0
For the ping response, assuming it arrives on wlan0, it would first pass the PREROUTING rules. My question is that at this point, what will it gain by checking the routing table because the diagram suggest a routing decision is made; or is it just to check if a packet does not have IP associated with any of the interfaces on the machine ?
networking netfilter
Your diagram is a diagram of how packets progress through IPTABLES, not how the raw networking stack works. All that IPTABLES stuff happens before the packet even gets to the underlying network stack, and it allows you to do a lot of things with packets, like rewrite source and destination IPs and ports, or otherwise altering, dropping, or blocking packets. Then... after they get through that, they finally reach the network stack. Read this instead: cubrid.org/blog/understanding-tcp-ip-network-stack
– Tim Kennedy
2 hours ago
@TimKennedy I may have been confused because I also saw this diagram en.wikipedia.org/wiki/Netfilter#/media/… .. which kind of shows iptable sequence in the network stack
– Jake
2 hours ago
@TimKennedy Do you know any online resource that shows a full picture containing TCP/IP stack and netfilter ? Thanks
– Jake
1 hour ago
add a comment |
I am trying to understand the packet traversal in Linux. I found a diagram from link.
My linux box has the following routing table:
default via 192.168.2.1 dev wlan0 proto static metric 1024
169.254.0.0/16 dev wlan0 scope link metric 1000
192.168.2.0/24 dev wlan0 proto kernel scope link src 192.168.2.73
If I send a ping to 8.8.8.8:
- It would first pass OUTPUT table rules
- The routing decision will check routing table and use the default route which states using the device wlan0
- It will pass POSTROUTING rules and will be send out on wlan0
For the ping response, assuming it arrives on wlan0, it would first pass the PREROUTING rules. My question is that at this point, what will it gain by checking the routing table because the diagram suggest a routing decision is made; or is it just to check if a packet does not have IP associated with any of the interfaces on the machine ?
networking netfilter
I am trying to understand the packet traversal in Linux. I found a diagram from link.
My linux box has the following routing table:
default via 192.168.2.1 dev wlan0 proto static metric 1024
169.254.0.0/16 dev wlan0 scope link metric 1000
192.168.2.0/24 dev wlan0 proto kernel scope link src 192.168.2.73
If I send a ping to 8.8.8.8:
- It would first pass OUTPUT table rules
- The routing decision will check routing table and use the default route which states using the device wlan0
- It will pass POSTROUTING rules and will be send out on wlan0
For the ping response, assuming it arrives on wlan0, it would first pass the PREROUTING rules. My question is that at this point, what will it gain by checking the routing table because the diagram suggest a routing decision is made; or is it just to check if a packet does not have IP associated with any of the interfaces on the machine ?
networking netfilter
networking netfilter
asked 2 hours ago
JakeJake
529722
529722
Your diagram is a diagram of how packets progress through IPTABLES, not how the raw networking stack works. All that IPTABLES stuff happens before the packet even gets to the underlying network stack, and it allows you to do a lot of things with packets, like rewrite source and destination IPs and ports, or otherwise altering, dropping, or blocking packets. Then... after they get through that, they finally reach the network stack. Read this instead: cubrid.org/blog/understanding-tcp-ip-network-stack
– Tim Kennedy
2 hours ago
@TimKennedy I may have been confused because I also saw this diagram en.wikipedia.org/wiki/Netfilter#/media/… .. which kind of shows iptable sequence in the network stack
– Jake
2 hours ago
@TimKennedy Do you know any online resource that shows a full picture containing TCP/IP stack and netfilter ? Thanks
– Jake
1 hour ago
add a comment |
Your diagram is a diagram of how packets progress through IPTABLES, not how the raw networking stack works. All that IPTABLES stuff happens before the packet even gets to the underlying network stack, and it allows you to do a lot of things with packets, like rewrite source and destination IPs and ports, or otherwise altering, dropping, or blocking packets. Then... after they get through that, they finally reach the network stack. Read this instead: cubrid.org/blog/understanding-tcp-ip-network-stack
– Tim Kennedy
2 hours ago
@TimKennedy I may have been confused because I also saw this diagram en.wikipedia.org/wiki/Netfilter#/media/… .. which kind of shows iptable sequence in the network stack
– Jake
2 hours ago
@TimKennedy Do you know any online resource that shows a full picture containing TCP/IP stack and netfilter ? Thanks
– Jake
1 hour ago
Your diagram is a diagram of how packets progress through IPTABLES, not how the raw networking stack works. All that IPTABLES stuff happens before the packet even gets to the underlying network stack, and it allows you to do a lot of things with packets, like rewrite source and destination IPs and ports, or otherwise altering, dropping, or blocking packets. Then... after they get through that, they finally reach the network stack. Read this instead: cubrid.org/blog/understanding-tcp-ip-network-stack
– Tim Kennedy
2 hours ago
Your diagram is a diagram of how packets progress through IPTABLES, not how the raw networking stack works. All that IPTABLES stuff happens before the packet even gets to the underlying network stack, and it allows you to do a lot of things with packets, like rewrite source and destination IPs and ports, or otherwise altering, dropping, or blocking packets. Then... after they get through that, they finally reach the network stack. Read this instead: cubrid.org/blog/understanding-tcp-ip-network-stack
– Tim Kennedy
2 hours ago
@TimKennedy I may have been confused because I also saw this diagram en.wikipedia.org/wiki/Netfilter#/media/… .. which kind of shows iptable sequence in the network stack
– Jake
2 hours ago
@TimKennedy I may have been confused because I also saw this diagram en.wikipedia.org/wiki/Netfilter#/media/… .. which kind of shows iptable sequence in the network stack
– Jake
2 hours ago
@TimKennedy Do you know any online resource that shows a full picture containing TCP/IP stack and netfilter ? Thanks
– Jake
1 hour ago
@TimKennedy Do you know any online resource that shows a full picture containing TCP/IP stack and netfilter ? Thanks
– Jake
1 hour ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507607%2fpacket-traversal-in-the-linux-networking-stack%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507607%2fpacket-traversal-in-the-linux-networking-stack%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Your diagram is a diagram of how packets progress through IPTABLES, not how the raw networking stack works. All that IPTABLES stuff happens before the packet even gets to the underlying network stack, and it allows you to do a lot of things with packets, like rewrite source and destination IPs and ports, or otherwise altering, dropping, or blocking packets. Then... after they get through that, they finally reach the network stack. Read this instead: cubrid.org/blog/understanding-tcp-ip-network-stack
– Tim Kennedy
2 hours ago
@TimKennedy I may have been confused because I also saw this diagram en.wikipedia.org/wiki/Netfilter#/media/… .. which kind of shows iptable sequence in the network stack
– Jake
2 hours ago
@TimKennedy Do you know any online resource that shows a full picture containing TCP/IP stack and netfilter ? Thanks
– Jake
1 hour ago