Industrial Internet of Things (IIoT), as the integration of industrial network and IoT, has attracted a lot of attention from both academia and industry. However, with such integration deepens, many issues suffered by the industrial networks are exposed and magnified. The secure routing is a key focus, since the industrial environment is extremely vulnerable and many potential threats (eg, distributed denial of service and selfish attacks) are introduced due to the connection to the Internet. In order to prevent the threats from the Internet and embrace the benefits of IIoT, a security‐driven network framework for routing is particularly designed. Specifically, we first leverage the technologies of software‐defined networking (SDN), network function virtualization (NFV), and blockchain to create the overall framework which is flexible, programmable, and secure. On one hand, the three‐level structure of SDN/NFV is applied to each domain, based on which we can flexibly control and program the underlying forwarding devices in this domain for the purpose of calculating the optimal routing policies. On the other hand, the blockchain is applied among different SDN controllers to create a trust and untamperable environment. Then, under this framework, a secure routing mechanism is proposed as well to prevent the attacks on the basis of node identity authentication and node behavior authentication. The simulation experiments are carried out on the OMNet++ platform and the experimental results indicate that the proposed mechanism outperforms the other state‐of‐the‐art methods in terms of scalability and robustness especially when encountering malicious attacks.